ClarkGoble
01-20-2003, 02:26 AM
There are three classes of X11 applications for the Mac.
The first is the easiest to deal with. Those are from fink and are typically installed with "sudo deselect", "sudo fink install x" or using Fink Commander. (The latter unfortunately isn't working on my system at the moment)
The next is, in some ways even easier. In others not so easy. These are packaged installers. These typically come in a .dmg file which launches a traditional OSX installer. Examples of this are the Open Office OSX beta, the Aqua version of TCL/TK, and several others. In general if you find it listed on a place like Version Tracker rather than Fink, it will install automatically for you. Why this is sometimes a bad thing we'll get to later.
The final is the hardest. These are programs which, even if ported to OSX, come with no default installer. The authors assume that if you want to install if you may know enough Unix to install it yourself. If you download files from SourceForge, you'll probably end up with a few of these.
Fortunately these files are not really that hard to deal with. I'll go through an example of one of these later. However here's the brief general solution.
The files come as .tar.gz or something like that. (There are a few other extensions, but they are all pretty much the same and Stuffit will unstuff all of them) Double click on them to unstuff the file to a directory.
Open up a terminal window and go to the directory you just unstuffed. (The shortcut is to type cd and then drag the folder to the terminal window) The first thing you should do is open up the file called README. You'll probably have to drag and drop it on a text editor like TextEdit or BBEdit. If there is anything unusual, it'll probably be here.
Most Unix programs use a program called Make which both compiles the program and typically installs it.
To start type ./config or in other cases ./configure
This will setup the compilation process. It may ask you for a directory to place the files. Read through the rest of this hint before deciding where to put it.
Now type make depend
In most programs this will just give you an error. Occasionally though it will set up anything that the compilation depends upon. Some programs use a different term. If so, the README will say.
Next type make
The computer will chug and a bunch of compilation messages will flash across the screen. If there is an error you can elect to try and figure out what went wrong. However since you are reading this tutorial you probably don't know enough to fix it, so just skip it and hope an OSX version comes out soon.
Finally type make install
This installs the files. They typically are copied over to /usr/bin or /usr/local/bin. In some cases it may just make a full directory and then put what is called a symlink (basically an alias) in one of those locations.
If you feel uncomfortable putting files in those system directories there typically are ways to change the location. However those are generally fixed by modifying the make files. We'll not cover that. Typically it is fairly self-explanatory where to put the directory you wish things to go in. However Unix programmers are an odd lot and clarity of presentation isn't a buzzword amongst them. (Unless it is something clear to other Unix developers)
If you are going to have a unique directory structure, like Fink does, I'd suggest making your own Fink-like directory. The advantage of this is that if Fink ever ports the program you compiled, you won't have half of it already in the /sw directories confusing Fink. Further you can also keep things straight. This is also, btw, an advantage of not putting things in Apple's directories. Often installers, especially OSX package installers, do this. Then your programs that assume a version in /bin /usr or so forth suddenly stop working. (As has happened to me more than once)
If you are making your own directory try something like /mysw.
The final thing I'll bring up is the rather common case where the program doesn't install itself anywhere. Typically in these cases they commands are still there in the directory you compiled. In these cases you have to copy them yourselves.
If you choose to put them in your own directory, make sure that you update your path in your .tcshrc file.
For instance I put most programs I compile into ~/bin. Because I set my .tchsrc the way Apple suggested, I simply add the directory to ~/Library/initi/tcsh/path. So for me I have the following in my path file:
tenv PATH ~/bin:${PATH}:/usr/local/bin:/usr/local/sbin
Probably you don't want the /usr/local/sbin in yours, unless you are going to be doing administration work. Look in that directory before taking it out though. There may be some commands you want.
I suggest putting commands others don't use in ~/bin. I like it and tend to put my own shell scripts there. Metrowerks puts their commands there too, I notice, as does Stuffit.
The first is the easiest to deal with. Those are from fink and are typically installed with "sudo deselect", "sudo fink install x" or using Fink Commander. (The latter unfortunately isn't working on my system at the moment)
The next is, in some ways even easier. In others not so easy. These are packaged installers. These typically come in a .dmg file which launches a traditional OSX installer. Examples of this are the Open Office OSX beta, the Aqua version of TCL/TK, and several others. In general if you find it listed on a place like Version Tracker rather than Fink, it will install automatically for you. Why this is sometimes a bad thing we'll get to later.
The final is the hardest. These are programs which, even if ported to OSX, come with no default installer. The authors assume that if you want to install if you may know enough Unix to install it yourself. If you download files from SourceForge, you'll probably end up with a few of these.
Fortunately these files are not really that hard to deal with. I'll go through an example of one of these later. However here's the brief general solution.
The files come as .tar.gz or something like that. (There are a few other extensions, but they are all pretty much the same and Stuffit will unstuff all of them) Double click on them to unstuff the file to a directory.
Open up a terminal window and go to the directory you just unstuffed. (The shortcut is to type cd and then drag the folder to the terminal window) The first thing you should do is open up the file called README. You'll probably have to drag and drop it on a text editor like TextEdit or BBEdit. If there is anything unusual, it'll probably be here.
Most Unix programs use a program called Make which both compiles the program and typically installs it.
To start type ./config or in other cases ./configure
This will setup the compilation process. It may ask you for a directory to place the files. Read through the rest of this hint before deciding where to put it.
Now type make depend
In most programs this will just give you an error. Occasionally though it will set up anything that the compilation depends upon. Some programs use a different term. If so, the README will say.
Next type make
The computer will chug and a bunch of compilation messages will flash across the screen. If there is an error you can elect to try and figure out what went wrong. However since you are reading this tutorial you probably don't know enough to fix it, so just skip it and hope an OSX version comes out soon.
Finally type make install
This installs the files. They typically are copied over to /usr/bin or /usr/local/bin. In some cases it may just make a full directory and then put what is called a symlink (basically an alias) in one of those locations.
If you feel uncomfortable putting files in those system directories there typically are ways to change the location. However those are generally fixed by modifying the make files. We'll not cover that. Typically it is fairly self-explanatory where to put the directory you wish things to go in. However Unix programmers are an odd lot and clarity of presentation isn't a buzzword amongst them. (Unless it is something clear to other Unix developers)
If you are going to have a unique directory structure, like Fink does, I'd suggest making your own Fink-like directory. The advantage of this is that if Fink ever ports the program you compiled, you won't have half of it already in the /sw directories confusing Fink. Further you can also keep things straight. This is also, btw, an advantage of not putting things in Apple's directories. Often installers, especially OSX package installers, do this. Then your programs that assume a version in /bin /usr or so forth suddenly stop working. (As has happened to me more than once)
If you are making your own directory try something like /mysw.
The final thing I'll bring up is the rather common case where the program doesn't install itself anywhere. Typically in these cases they commands are still there in the directory you compiled. In these cases you have to copy them yourselves.
If you choose to put them in your own directory, make sure that you update your path in your .tcshrc file.
For instance I put most programs I compile into ~/bin. Because I set my .tchsrc the way Apple suggested, I simply add the directory to ~/Library/initi/tcsh/path. So for me I have the following in my path file:
tenv PATH ~/bin:${PATH}:/usr/local/bin:/usr/local/sbin
Probably you don't want the /usr/local/sbin in yours, unless you are going to be doing administration work. Look in that directory before taking it out though. There may be some commands you want.
I suggest putting commands others don't use in ~/bin. I like it and tend to put my own shell scripts there. Metrowerks puts their commands there too, I notice, as does Stuffit.