Setting my environmental PATH

Joined
May 12, 2010
Messages
5
Reaction score
0
Points
1
Hi guys,

I'm trying to install a 'pre-compiled binary release' through terminal. Basically I am being told to move the files 'cufflinks' and 'cuffcompare' binaries in your PATH environment variable.

So my question is what is the PATH environmental variable?

And how do I move these files to that?

I have looked elsewhere for the answer however I haven't found a suitable answer so far. Sorry for the newbie question.

Thanks very much, JP
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
It sounds like what you are being told is to add the path where cufflinks and cuffcompare are located to your PATH environment variable. This is done so that you can just type either of those names in the Terminal and the system can find them and execute them. Otherwise you have to type the full path to execute those executables.

How you set the path is dependent on the shell being used. The default shell for OS X is now Bash. To add a path to the PATH environment variable is done like this;
Code:
export PATH=$PATH:/Users/Shared

When you type a command that resides in that last path, you no longer have to type the whole path. Note also, that the shell searches through the paths in the order that they appear. This is important to know when you have two commands with the exact same name.

Do a 'man bash' in the Terminal and look under the 'INVOCATION' section. You'll note that if you add your export command to one of three possible login shell files, that you will not have to type that command every time you start the shell.
 
Joined
Dec 13, 2007
Messages
256
Reaction score
10
Points
18
Location
United States of America
Your Mac's Specs
2.1GHz MacBook with 4GB RAM, Mac OS X 10.6, iLife and iWork ‘09
$PATH is a variable in the Terminal that tell the computer which directories contain programs; that is, when you type a command such as ls at the command-line, ls is the name of a program in one of the locations specified by $PATH.

To figure out where a binary is, you can use the which command. For example, typing which ls should return something like /bin/ls, which means that if you were to navigate to the /bin directory, you'd see the ls program within.

To see the list of locations that are currently set for $PATH, you can type echo $PATH at the command-line. It will return a list of directories (folders) separated by colons; these are the locations that will be checked in when you type a command name. In your case, you could copy those programs to a place like /usr/bin by typing the following command:
Code:
sudo cp [I]program_name[/I] /usr/bin/
You'll need to type in your administrator password for the command to work because /usr/bin is a system directory (you get permission to move files there with the sudo command). This will copy the program you choose to that folder, at which point you can simply type its name and press Return to run it.



Alternatively, if you don't want to mess with using the sudo command (which you should always be extremely careful with), you can add a new directory to your $PATH, from which you'll be able to run commands in the future. To do this, you need to edit either .bashrc or .bash_profile. For example, type
Code:
open -a TextEdit ~/.bash_profile
This will open your Bash profile (think of it as command-line preferences) in TextEdit, where you can add this line to the bottom:
Code:
export PATH=$PATH:[I]/new/directory[/I]
where /new/directory is the folder you want to add to your $PATH. For example, if you make a folder in your Home directory called Programs, you could run the command
Code:
export PATH=$PATH:/Users/[I]your_username[/I]/Programs
and any binaries you put in that folder will run when you type their names at the command prompt.

Once you add that line to the file, save it and close it. For the change to take effect, type
Code:
source ~/.bash_profile
This command tells the computer to look at .bash_profile and update any changes, which will in this case update your $PATH. To make sure it took effect, you can type echo $PATH again, and you should see the same list you saw before with your new location at the end. Then, when you add any programs to the folder you chose (in this example, /Users/your_username/Programs), you'll simply be able to type their name at the command prompt and press Return to run them.



There's one final thing worth saying. If you only want to run a program once, you can navigate to the directory containing it and type the command name preceded by a period and a slash (./) to run the program regardless of whether the containing folder is in your $PATH or not. As an example, if your cuffs program is in your Downloads folder, typing the following two commands would run it a single time:
Code:
cd ~/Downloads
./cufflinks



Hopefully that little overview will help you out. :) If you want to find out more, search for "bash path" on a search engine and you should get relevant results.
 
OP
J
Joined
May 12, 2010
Messages
5
Reaction score
0
Points
1
Thanks guys I managed to move the files prity successfully. Have got myself a UNIX book now aswell.

I have another problem now though:

I am trying to install another program it tells me to do this:

"To install TopHat, unpack the tarball and change to the package directory as follows:

tar zxvf tophat-1.0.7.tar.gz

cd tophat-1.0.7/

Now build the package:

./configure --prefix=/path/to/install/directory/

make

Finally, install TopHat:

make install"

I have tried to do this however it says there aren't the commands configure and make. I'm running bash on OS X Leopard on my Macbook Pro. Are 'make' and 'configure' not the commands used in bash?

Thanks, James
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
scathe is correct. You will need to install the Xcode developer tools to get all the tools you need to build programs. As scathe mentioned, take a look at your install discs or download it from Apple's developer website.
 
OP
J
Joined
May 12, 2010
Messages
5
Reaction score
0
Points
1
Thanks guys, I have installed Xcode now and the 'make' cmd works. But it still doesn't recognise 'configure' as a command?

J
 
Joined
Jan 12, 2009
Messages
1,096
Reaction score
19
Points
38
Location
Prague, Czech Republic
Your Mac's Specs
2,4Ghz 15" unibody
ok hold it, is there even a "configure" command? U sure it doesn't just refer to a file in the current directory with the name "configure"?

maybe it's just a file that doesn't have execute permissions? to add the execute permission run:
chmod +x filename
in this case chmod +x ./configure

first check if such file exists of course
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
scathe is again correct - configure isn't a command/program but is a file included with many programs distributed as source. You need to execute it as such: ./configure. The ./ at the beginning signifies that the command is going to be executed from the current directory.

Note what you posted earlier:
./configure --prefix=/path/to/install/directory/
 
OP
J
Joined
May 12, 2010
Messages
5
Reaction score
0
Points
1
Thanks again scathe and vansmith. I did sort it out eventually. It was a file just a misplaced one, I did need the Xcode though.

Thanks a lot!

James
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
Also, for some stuff to install correctly you might have to use :
sudo make install
so it can install in places where you don't usually have permission to put things.
Depends on what you're installing and where it needs to go.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top