1

I have recently installed Octave, a MATLAB clone, onto the following directory:

/Applications/Octave.app/Contents/Resources/bin/octave  

I want to run it from a shell command prompt from a different directory, say, from my home directory ~. I know that I can type the full path to the octave executable, but that is very cumbersome. I know that on linux computers you can edit your .bashrc file to include paths to special directories with executables. How do I accomplish that here in Mac OS?

3

Edit your .bashrc (or .bash_profile, .login, etc.) on a Mac, and add the line

alias octave='/Applications/Octave.app/Contents/Resources/bin/octave'
  • In linux computers, aliases don't pass into shell scripts. This is why we export paths to the bashrc file. I imagine mac computers have the same problem. Is there a way to include this path for later use in shell scripts? – Paul May 2 '12 at 13:29
  • In linux computers, and OS X, login scripts (.bashrc, .bash_profile) are treated differently by user login (interactive shell) versus script. Put the alias in the appropriate place (linux or OS X) and your shell scripts will have access to the alias. I think .bashrc is interactive only, and .bash_profile is accessed by shell scripts. – user588 May 2 '12 at 15:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .