After years of resistance I finally caved and bought a sleek, shiny MacBook Pro over the weekend. I’ve been slowly figuring out how to set up my AMES development environment and that means figuring out the basics of using the Unix shell. I struggled to find a simple explanation of how to set environment variables, so I’m inserting a couple of screen grabs which illustrate how to add MTASC and Swfmill to the PATH environment variable.
I downloaded, unzipped and placed the mtasc and swfmill binaries in their respective folders in the following folder:
/usr/local/bin
Method 1 : A Session Variable - Using the bash shell, this adds the mtasc and swfmill binaries to the PATH variable for the current terminal session. When you close the shell and reopen it, you’ll have to add the files to the PATH variable again.

export PATH=$PATH:/usr/local/bin/mtasc:/usr/local/bin/swfmill
Method 2: Add to Startup Script - Place the command in a startup script called bashrc which can be found along the path below. The modified PATH will always be available to any bash shell and no further editing is needed.
/etc
This method is similar to how environment variables are set in Windows (without the gui absraction layer). the bashrc file is a simple text file and you simply add the commands to this script which is run everytime the os loads.

9 Comments
You’d do it in your home foldre instead.
That do not need admin privileges.
cat > ~/.profile
PATH=$PATH:/usr/local/bin/
[Control-C]
That’s all.
No need to reference all the plain reference, paths suffice here.
Very cool–if only I’d known a couple of days ago.
Sorry I couldn’t find a more appropriate place to ask my lame rookie question
swfmill was working with simple tests the first time I tried it, now I am getting errors seeming to indicate no modify/create permission, I have read/write permit for files and folder
/millfolder/swfmill swf2xml /millfolder/test1.swf
outputs good result to terminal
/millfolder/swfmill swf2xml /millfolder/test1.swf|/millfolder/test1.xml
if test1.xml exists:
-bash: /millfolder/test1.xml: Permission denied
if test1.xml does not exists:
-bash: /millfolder/test1.xml: No such file or directory
Hmm, I’m not really sure what your issue is, but I’d probably try to make sure swfmill is set up as unix executable.
You’ll need to cd to the directory where swfmill is located and then type the following in bash:
chmod 777 swfmill
Hopefully that does the trick for you.
Hey, thanks for this note. i just bought a new mbp and am struggling … I’m trying to install mit scheme so i can work through sicp, but can’t mv the downloaded file into /usr/local/ through the terminal:
Jeffs-Computer:~ jeff$ mv ./mit-scheme-20070909-ix86-apple-darwin.tar.gz /usr/local/mit.tar.gz
mv: rename ./mit-scheme-20070909-ix86-apple-darwin.tar.gz to /usr/local/mit.tar.gz: Permission denied
i enabled root and try sudo, which doesn’t move the file (?):
Jeffs-Computer:~ jeff$ sudo mv ./mit-scheme-20070909-ix86-apple-darwin.tar.gz /usr/local/mit.tar.gz
WARNING: [... blah blah don't use sudo ...]
Password:
Jeffs-Computer:~ jeff$ ls /usr/local/
OpenSourceLicenses OpenSourceVersions
so, i’m not sure wassup, or if it’s really necessary for me to put the bin in /usr/local/ …
any ideas?
jz
Oops, should have mentioned i’m using leopard, if that makes a difference.
I have seen this permission problem with Leopard. I found that I could log in using sudo via the X11 terminal.
adding the path via the instructions in comment #1 will wipe out any previous custom settings you may have in your .profile file
Do we have seperate method for setting the environment in windowsXP. I am having this particular problem when in run the functiom mpd…
??? Error using ==> bookread at 26
Can’t open file [tempbook.bin]
Error in ==> mpd at 35
varargout{1} = bookread(’tempbook.bin’);
Error in ==> final_sim_with_noise at 75
[Book ,residual ,decay] = mpd ( y, 10 ,’D')
Can someone help, please… we need it to complete our project. thank you….
One Trackback
[...] Seetting Mac/Unix Environment Variables Leave a Comment [...]