Mac shell script run app
I forget the original issue I ran into. Feel free to backport these changes into your original gist if you like!
Platypus - Create Mac apps from command line scripts
I used this today to on a. When launching the app it states: "You can't open the application I'm running Mountain Lion. Any ideas? OS X Same problem, the end result seems to be a PowerPC app. I guess it's just a matter of changing one of the triggers? Running on mac OSX I had to add the!
I had to modify my plist to be correct as noted previously. It then worked for me. I made it to work on OS X I'm not familiar with the OS X plists internals It started working OS X Just put the correct shebang on your. For instance:! Also, don't forget to add execution permission for your. With these steps, there is no PowerPC error :.
- How to Launch GUI Applications from the Terminal;
- add text to photos mac free.
- speco dvr player for mac.
- how to unzip files on mac with winrar?
- How to Turn Bash Scripts Into Clickable Apps Using AppleScript.
- AppleScript/Unix: How to get the current MacOS foreground application name | ilodykuh.tk.
Trying to run Electron without using electron-packager. I tried the Automater way of doing it, but it wasn't ideal. When you're troubleshooting problems, it might look like changes to the shebang line or such things could do the trick, but they do not. The problem is that macOS caches app information which might result in things not working even after you modified the bundle. If that is the case, just run "touch" on your application's bundle. That will make macOS re-read your Info. Adding plist and make sure that schell scripts and plist values have the same name as the app made it work fine.
All you need to do to make the app work is make sure you have! Also try making the shell script executable with Terminal:. After doing that, this message will not appear because your computer recognises that the application is trying to run an executable shell script and not some other random file :.
You can grab out of my frameworks and just edit the script continained. Skip to content. Instantly share code, notes, and snippets. Code Revisions 10 Stars Forks Right now the project itself is selected in the navigation area and the center editor shows various properties of the project.
These were already set to useful defaults when the template was setup. There are four files in this particular template.
How to Launch GUI Applications from the Terminal
The editor will change to a graphical area to design the interface. However, there is no window to put an interface visible.
There is a list of icons, next to the navigation bar, representing various objects in this xib file. The lowest is a window. In the lower right corner of the Xcode window is a list of objects that can be added to the interface. You may have to select the circle icon with a square in it to see it. You can scroll through the list, but there are so many objects that it is easier to use the search field at the very bottom.
As you drag the button around the window, you will see blue lines appear, guiding the button to the right center line or the right distance from the edges of the window. Use the blue guide lines to drop the button in the center of the window. You can double-click the text on the button to change the default label. Since this is the first time to build this project it will take a bit longer. To connect the button to some action, we need to connect it to some code.
We need to show the code and the UI side-by-side. By default Xcode will show a header file we do not care about in the second panel.
The template filled the AppDelegate. We want perform an action method in the AppDelegate when the button it clicked. When you end the drag there a small dialog will pop up asking for specific settings. Set it to be an action, name it talk and set the sender type to NSButton. The IBAction is a label for the interface builder part of Xcode to know this function is available to connect to the UI. In the brackets we define one parameter, labelled sender of type NSButton. The curly braces enclose the function code which is still empty.
While you are typing Xcode will suggest completions for the code that you are typing. This can be very helpful and helps you avoid typing errors. You can hit the tab-key to accept the suggestion. The let statement is very particular to Swift and declares a variable as constant. The alternative label var would tell the compiler that we plan to change the content of the variable later.
Choosing let and var properly will allow the compiler to optimize the resulting code. For example in this specific case, the compiler will use a non-mutable string and array class for our arguments, since they will not change later in the code.
Adding a custom app icon
If you replace let with var and build then the compiler will notice you are not modifying the variable and place a warning that you should use let instead. Since the say command will not run within a shell and we cannot rely on environment variables being set, especially the PATH variable, we need to give the full path to the say command.
To figure out the full path to a command you can use the which command in Terminal. The arguments are passed as an array of Strings. Right now we have only a single static argument, but we could pass more, each option or argument will be its own String in the array. Finally we use the NSTask class to create and launch the command. There is a minor problem in the UI. One solution to that is to disable the button while the task is being processed. Alle interface elements have an enabled property we can use for that purpose.
Change the talk method to this:. Before we execute the task, we disable the button, then enable it later. Now, when you click the button it will be disabled while the task is running and be re-enabled afterwards.