Unix on Mac OSX
This is a legacy page and may have outdated content.
Applications started from the command line sometimes depend on environment variables for configuration. For instance, Java looks to the CLASSPATH variable to know from where it is supposed to load software.
This is done by editting a file by the name of .profile (more info!) inside the root of your home directory and adding the information to the file. The file needs to be created if it does not already exist. e.g.
>Other *nix flavors use a file named after the shell program in use. If you are using bash, the file is .bashrc; if you are using tcsh, the file is .tcshrc. (Genreally, an rc file is a script file containing startup instructions for an associated program.)
After updating the script file, you could create a new terminal window to have it start using the changes. Or you could enter
source .profileto have it load the file and use it in the existing terminal window.
To configure a Mac OS X user account so that .DS_Store files are not created when interacting with a remote file server using the Finder
- Open the Terminal.
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
- Press Return.
- Restart the computer.
This will affect the user's interactions with SMB/CIFS, AFP, NFS, and WebDAV servers.
A good explanation of configure, make, make install
A script can be made into an executable file. (Use the chmod command from the Terminal command line to make it executable.) It can then by run from the Terminal. Unless that script is in the path, you will need to preface it with a "./" so that the shell looks for it in the current directory.
A script can also be made to run by double-clicking on it in a finder window so it opens in the Terminal application.
Either put a '.command' extension on the script file, or use the Finder Get Info window to associate the script's extension with the Terminal application so that it will open in Terminal. (Be careful to not associate all files of that extension with the Terminal program unless you understand the consequences.)
There is an unfortunate weirdness with this double-clicking technique in that the terminal window will stay open after the script completes. (And of course the Terminal application won't close either.)
The script will need to have a "shebang" line that starts with the '#' character and contains or indicates the path to the script interpreter.
As an example, this could be the contents of a ruby script:
In that example, the path to the ruby script interpreter was hard-coded into the script. Alternatively if you put
then "env" will search the path for the interpreter, so it can be executed.
Here is another example: this would be a shell script: