Forwarding Address: OS X

Wednesday, December 03, 2003

A friends recently took the plunge and installed MySQL but got a bit stumped when it came time to muck around with settings via the command line. Perhaps our exchange will be of use to others looking to do the same:
I've installed the MySQL package from Server Logistics and I'm real rusty in the Terminal. I'm trying set the path so I don't have to type the entire string all the time.

Now I don't see a file called ".tcshrc" in my home directory so I need to make one. Just call name the file with the extention?

Yep, exactly. In Unix a file that starts with a period doesn't actually have an extension, the period tells the system that the file should be invisible (like the Finder's Invisible flag). This is used to hide configuration files from the user and works with any file (stick a period at the beginning of a JPEG's filename and it'll disappear from sight).

Before we go further, a few key unix commands you'll need:

ls
Shows all the _visible_ files in a directory

ls -al
Shows _all_ the files in a directory, including the invisible ones

locate
Unix locate utility, much faster than the Finders and it'll find files the Finder won't (like .tcshrc)
Used like: > locate .tcshrc
Returns: > /Users/god/.tcshrc

pwd
Stands for "print working directory". Shows you the complete path to where you currently are

Not to mention I get confused between /Users/myuser and /usr/local for "home directory". It would be /Users/myuser, right?

When docs refer to the Home directory, they means yours, in this case /Users/myuser. /usr/local is system-wide and probably not where you want to make these changes.

Can I make this file using Pico? The Thomas Berger notes mention an app called "vi" but running that in Terminal appears totally greek to me.

Yes but the Unix geeks will laugh at you. Personally I like pico and use pico for all my cmd-line text editing because I've never been able to figure out how to use vi or vim or emacs and don't care to take the time to learn. Your choice of text editor appears to be a huge deal in the Unix world (go figgur). When unix geeks ask me and I say "pico" they laugh at me and then usually get into a shouting match with each other over vi vs. emacs.

I don't know how familiar you are with pico but none of the key commands are the same as any standard Mac app. The important ones:

Saving: control-O (oh)
Quitting: control-X
Cancelling: control-C

BTW, BBEdit's "Open Hidden..." feature is invaluable for this sort of thing too, as it'll let you open and edit text files normally invisible to GUI applications. pico's great for small stuff like this but for editing the likes of Apache's massive conf files nothin' beats BBEdit.

Finally, here's what my .tcshrc looks like so you have something to compare to:

setenv PATH "$PATH":/Library/MySQL/bin
setenv PATH "$PATH":/Library/PostgreSQL/bin
setenv LC_ALL C
setenv CVSROOT "/usr/local/cvsrep"

Discuss