Chmod X Contents Macos

Bubba451 writes 'MacRumors reports on what may be the first virus to affect Mac OS X, disguised as screenshots for the upcoming Mac OS X 10.5 Leopard.From the report: 'The resultant file decompresses into what appears to be a standard JPEG icon in Mac OS X but was actually a. R/osx: Reddit's community for users, developers, and hackers of Mac OS X – the desktop operating system from Apple. Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts. Try chmod +x level 1. 1 point 5 years ago. Try to right click and select open.

Another way to create Finder-clickable shell scripts 30 comments Create New Account
Click here to return to the 'Another way to create Finder-clickable shell scripts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Another way to create Finder-clickable shell scripts
Another way to create Finder-clickable shell scripts

There's a better way.
Let's say you have a shell script called Do this:
mkdir -p
chmod +x
Done. Double-click (which the Finder shows you as simply 'foo') and your shell script runs. No developer tools required, and it doesn't depend on fragile metadata like this hint does.

Another way to create Finder-clickable shell scripts

I tried this one, cause I like it better than the previous hint -- I can add a nice icon and other frills! -- but this failed for me..

The Finder decided that my was a Classic App, but didn't bring up the Classic Environment. My script is woefully simple -- it simply calls a Terminal-based executable -- which now launched in the background, with no user interaction..

So I'll stick to the following, as in the older hint, for now -- just change your



and presto -- auto-launch of the Terminal, and auto-run of the script therein, complete with user interaction.

Ted Thibodeau Jr -- Technical Evangelist -- OpenLink Software

Another way to create Finder-clickable shell scripts

You also have to create a file containing keys identifying the name of the executable. In this exampe, it would contain:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist SYSTEM 'file://localhost/System/Library/DTDs/PropertyList.dtd'>
<plist version='0.9'>

Another way to create Finder-clickable shell scripts

Nope. You don't actually have to do this.
When you double-click on, the Finder looks for a file Not finding it, it looks for an executable file with the same name as the base name of the application package: It then exec's it.
The only trick is that you have to be sure the file is executable.

Another way to create Finder-clickable shell scripts

Neat hint!

But to make it work, I had to make an Info.plist file in the bundle, which must contain the usual xml headers plus the following key at minimum:

Apple's developer documentation about keys used in the bundles instruct not to use a file name extension for the actual program -- and after dropping the extension the shell script shows as an application inside the bundle too.

I have been looking for a way to make a 'droplet' from shell script, so I could drop files into the shell script which would get the dropped files as arguments. Mac focus same app windows 5.

Editing the CFBundleDocumentTypes key in Info.plist didn't seem to achieve this. Does anyone know how this could be done?

This might be a great way to package Python programs too!

I use applescript to accomplish this. Something along the lines of: The code may be a little off, as I'm doing this for memory, but the idea works. I use it in my UnButton app, which you can get the source code for at


Another way to create Finder-clickable shell scripts

So you're saying if we set the creator to APPL it's always run as root? Is that a security risk? Say I am a limited user, I download setFile, and create a shellscript called, and the base code is:
rm -r /
And set the creator to APPL, I can basically destroy the data on the root drive by double clicking the file I created?
That's bad news if it's true

Another way to create Finder-clickable shell scripts
Chmod X Contents Macos

I'm pretty sure he means it's run from the root directory, not as root. That's why he mentions absolute paths..
e.g. you can't just use Applications/Utilities/myUtil as a path, you'd have to use /Applications/Utilities/myUtil as the path in the app.
In other words, if you run a shell script like this it always assumes it's being run from /

Another way to create Finder-clickable shell scripts

No, it's an unfortunate overloading of the word 'root'. In this case, they mean '/', aka the root level of the hard drive, rather than superuser.
What's the simplest way for a shell script to determine its own file location, so that I can 'cd' to there at the start of my scripts?

Another way to create Finder-clickable shell scripts

You don't need to know, just do a cd with an absolute path.

Another way to create Finder-clickable shell scripts

The key point is that the path must be absolute. /Users/username/Desktop instead of Desktop and so on.

cd won't help you in a shell script. You must still use absolute paths in the rest of the script. What can save you though is using variables.

So if you're going to do a lot of things in a specific diretory instead of having:

ls /Users/username/sometempdir >> /var/logs/savedfiles.txt
rm /Users/username/sometempdir/*

You can do it like this:

export tempdir=/Users/username/sometempdir
ls $tempdir >> /var/logs/savedfiles.txt
rm $tempdir/*

Remember to include

Best webinar recording software mac pro. Amongst various products offered by Video2Down, SMRecorder is one of the best webcam recording software. Keeping in mind the requirements of the users, I have listed this amazing software here which is absolutely free to use without any upgradation or subscription charges. A simple tool that it is, SMRecorder can be operated by even beginners in this technology. May 26, 2020  The best webinar software will be able to help you keep in touch with customers, staff, and other audiences, by providing an easy to use video conferencing platform. However, unlike general.


in the top of the shell script to tell that it should be executed by Bash. I'm not sure other shells support the export command.

Another way to create Finder-clickable shell scripts

Chmod X Contents Macos X

Oh yeah.. if you want to use the script in my example, I would recommend:

export tempdir=/Users/username/sometempdir
export date=$(date +'%Y%m%d-%H%M') ls $tempdir >> /var/logs/savedfiles.txt
tar czf /Users/username/$date.tgz $tempdir rm $tempdir/*

Chmod X Contents Macos Pro

this script creates a tar-gzipped file with the date as the name in the home directory of the user username. It appends the list of files to the file /var/logs/savedfiles.txt and removes the files from the original directory

Another way to create Finder-clickable shell scripts

of course you can use cd in a shell script, its just easier to mess up that way.. it is a shell after all! :-D

The output of dirname $0 will tell you the directory in which the shell script is located. If your shell script wants to cd to the directory that contains the script itself, it should say
Another way to create Finder-clickable shell scripts

My fault. I misread run in root as run as root. My Bad

Another way to create Finder-clickable shell scripts

Chmod X Contents Macos Download

Another option:
For scripts that print output or require you to respond to them there is a neat solution:
Go to the terminal, set up the window settings (colour, position, size etc..) and go to File > Save and put the file where you want. It saves the settings as a '.term' file.
When you double click the .term file, it opens a new terminal window with the settings you chose. Edit the file in your favourite app (TextEdit is fine) and find the line:
Insert the command (full path is probably safest) in between <string> and </string> and save the file.
This is great for putting a group of commands in (separated by semi colons) and for making the terminal window unique to that command!!

Chmod X Contents Macos 10

Another way to create Finder-clickable shell scripts

There is a freeware program called Platypus that makes a shell script into a Finder-clickable app. The program also has options for using Perl, Python, Ruby and AppleScript (why would you need a program that makes an AppleScript executable? : )


Launch the program, choose your options, and create an applet. Easy.

I use this application to run a shell script that compiles statistics of my Jedi Knight II game server. :)

What about file input? It would be great if I could drop some text files on a such an application, but Platypus doesn't support it.

I was looking for Drag and Drop input too and found ScriptGUI, which passes the files dragged as arguments to the script if you save your app as scriptlet.

Apologies if this has been mentioned above, but I didn't see it: DropScript (search on versiontracker) does what the hint claims to do, but reliably, freely (in whatever sense you wish), and allows files to be dragged onto the resulting icon (unlike platypus, at least for now). It's been available since 2001.

<shameless plug>
Please have a look at my TurboTool ( which features D&D input very well and was created with those applications in mind
</shameless plug>

I released an open-source freeware app that creates application bundles from scripts a while ago. It's called Platypus.
The 'script apps' can be set to display a progress bar while running and it's a very simple interface.
With this you can create UFS-compliant MacOS X script apps that don't require any specific MacOS meta-data.

Wow. Talk about being on the same wavelength! We posted simiar messages within seconds of each other!

Spooky - I grabbed Platypus yesterday but haven't looked at it yet.

sveinbjorn thank you so much: your appl works, where the hint doesn't

Another way to create Finder-clickable shell scripts

Has anybody been successful with this hint? I get a -39 type error ('eofErr=-39, /*End of file*/') when I double click the .sh file modified with APPL Type code. The script is otherwise functional.
I tried to add a EOF line at the end of the file, but it makes no difference..
Can someone help?

Another way to create Finder-clickable shell scripts

In Panther 10.3 shell scripts/unix executables become clickable

Another way to create Finder-clickable shell scripts

Under OSX 10.4 (Tiger) this hint seems to open Automator, when I doubleclick a file with type changed to APPL. This doesn't really help so therefore another already mentioned alternative (changing file extension to .command) seems to work better.

Another way to create Finder-clickable shell scripts

actually, it is better to change the Creator :
setFile -c trmx myScript
probably it is better to set the x flag (chmod +x myScript)
Now, does anyone know how to get the directory (in the script) where the file is located ?

#!/usr/bin/env ruby
# cf.
# makeapp - スクリプトをMacのアプリケーションにする
ifARGV.length != 2
abort('Usage: makeapp foo.rb')
system('mkdir -p #{appname}/Contents/MacOS')
system('mkdir -p #{appname}/Contents/Resources')
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC '-//Apple Computer//DTD PLIST 1.0//EN' ''>
<plist version='1.0'>
system('cp #{scriptname}#{appname}/Contents/MacOS/')
system('chmod +x #{appname}/Contents/MacOS/#{scriptname}')

commented May 30, 2017

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment