Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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

alias octave='/Applications/Octave.app/Contents/Resources/bin/octave'
share|improve this answer
    
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
    

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.