Go Back   The macosxhints Forums > OS X Help Requests > UNIX - Newcomers



Reply
 
Thread Tools Rate Thread Display Modes
Old 12-05-2007, 02:48 PM   #21
kanenas
Prospect
 
Join Date: Mar 2007
Posts: 12
Editing .bash_profile

Here's the easiest way I can think of to edit a dotfile:
  1. open a terminal
  2. type `open ~/.bash_profile`
This should open .bash_profile in TextEdit (or some other GUI text editor). It works because open "opens a file (or a directory or URL), just as if you had double-clicked the file's icon", according to its manpage . The "~/" is probably superfluous as the shell's CWD (current working directory) should be your home directory when the shell launches. Note that the edited .bash_profile will help only if you're using bash. You may also want to edit .profile (for sh, ksh, zsh and bash [when there's no .bash_profile]) and .login (for csh and tcsh) if you plan on using other shells. For csh and tcsh, use the command 'setenv' rather than 'export'.

There are some instances where bash/csh/tcsh will source .bashrc/.cshrc/.tcshrc rather than .bash_profile/.login/.login (such as when opening a terminal under X11; the difference is that a X11 terminal is not a "login shell", if you want to google why), so you may also want to edit .bashrc/.cshrc/.tcshrc.

If you want or need '/usr/local/mysql/bin/' in the path available to GUI apps, add it to ~/.MacOSX/environment.plist. Don't forget to logout & login afterwards to get immediate results. I don't think "/usr/local/mysql/bin/:$PATH" will work in environment.plist; you'll need to enter the full, expanded path (type "echo $PATH" from a command line to get it). I haven't tested how this will interact with shell startup files or what other effects it will have on GUI apps. It should be fine as long as all the necessary directories are included in PATH.

You can also configure the Finder to show dotfiles so you can open .bash_profile et al from the GUI. From a command line, type: `defaults write com.apple.finder AppleShowAllFiles TRUE`, then restart the Finder by ctrl-opt-clicking on its icon in the dock and clicking "reload". To hide dotfiles, do the same but type "FALSE" instead of "TRUE" (I believe "YES" and "NO" will work instead of "TRUE" and "FALSE"). There are some Applescript and Automator solutions to easily toggle showing/hiding dotfiles.

The Unix learning curve mixed with a deadline is a recipe for frustration, assuredly. Given time to play, learning to use Unix can be quite a joy.
kanenas is offline   Reply With Quote
Old 12-05-2007, 08:08 PM   #22
Alex Yeh
Triple-A Player
 
Join Date: Dec 2006
Posts: 239
Smile

Quote:
Originally Posted by simonwh
Well, I fired up the Terminal window and entered the following text :

TextWrangler ~/.bash_login

Here’s what I got back :

-bash: TextWrangler: command not found

Assuming TextWrangler has installed the command-line tools for you (the default scenario for most people), then this is the command that you should enter in Terminal.app:

edit ~/.profile

Which should open your .profile file in TextWrangler. Another possibility is to just fire up TextWrangler, and then navigate to File => Open Hidden…, and choose "All Files" under the "Enable:" popup menu at the top of the window. You should be able to then click on and open your .profile file.

here’s an example PATH, which would find binaries from "hand-compiled" executables in /usr/local, Fink, MacPorts, and Developer Tools:

Code:
export PATH=$PATH:/usr/local/bin:/usr/local/sbin:/sw/bin:/sw/sbin:/opt/bin:/opt/sbin:/Developer/Tools:/De
veloper/Private
it might also be desirable to be able to read any man pages included with these executables. Here’s a MANPATH that would accomplish this:

Code:
export MANPATH=/usr/share/man:/usr/local/share/man:/sw/share/man:/opt/local/share/man
__________________
find / -iname *your\ base* -exec chown us:us {} \;

Last edited by Alex Yeh; 12-05-2007 at 08:22 PM.
Alex Yeh is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 10:17 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.