Useful Mac OS-X and Linux Tricks for Atmospheric and Oceanic Science Research


After upgrading to Yosemite (10.10), many things were broken, so I had to make a fairly clean start. These seem to be the essentials that I'm using now.

I'll do my best to keep this page more up-to-date. Please email me with suggestions and comments!

WARNING: Most of the notes below have fallen way out-of-date with the advances in OS. (Aaack, this makes me feel old.) I've kept them in case something might be useful.

10.08

Note that there is *finally* a pdf viewer for Firefox (version 3) on the Intel Mac! Get it here: PDF plugin for Firefox on Intel Mac!!!!



Install x11 and all the developers tools. You need them for fink.

for x11 you need a .bashrc

I initially put my preferences and aliasing in .profile, but realized that
it wasn't loading. It worked when I had the .bashrc source .profile.
But it's best just to put all the information in .bashrc to begin with.



To get scroll bars,
Look in your .xinitrc file (or make it). Add:

xterm -sb -sl 1000 &

The -sb gets you the scroll bar, -sl makes it 1000 lines.

This doesn't seem to work. But you can make it automatic by updating
the x11 preferences. Under the Applications heading, go to
Customized Menu. Here you can make the Terminal command:
xterm -sb -sl 1000
I made this the terminal that launches when you press [apple key]n

make your terminal even nicer and easier to read!!!!

xterm -sb -sl 1000 -fa Monaco -fs 12 -bg linen

Monaco's the only font I've been able to use. You can change the size with
-fs. -bg sets the background color
the color 'seashell2' is also decent, and 'cornsilk2'

(I changed to this default when I hooked my computer up to a higher
resolution monitor.)

See my .bashrc file for the most up-to-date terminal commands



Multiple desktops - a must! I got the Codetex version ($40) that is
quite nice. But there are some decent open souce versions to that you
can get for free. See:

http://tazman.princeton.edu/osx/

This website is amazing!

A friend is using the desk top manager version, and quite happy:
http://desktopmanager.berlios.de/



Get fink to get all the useful unix/linux codes you're used to using. Make
sure to install the mac developers tools before installing fink. This
will give you compilers, etc. that you need.

Using fink, I got:

-imagemagick (convert and other programs, great for changing from
eps to jpg, etc.)
-gv
-gimp (image processing)
-tetex (the full latex packages)
-ispell (a spell checker)

-gnome terminal [DOESN'T WORK!]
In search of a better terminal I tried downloading gnome-terminal.
But it doesn't work.



I found these applications to be quite handy. Not from fink.
(Just google them to find them.)

- quicksilver (a launcher)
- firefox (a browser) [also get the pdf viewer plugin:
"PDF Browser Plugin," so it doesn't have to use
preview to look at pdfs. This way it doesn't have to
automatically save the pdf to your desktop.
http://www.schubert-it.com/pluginpdf/ ]
- aquamacs emacs (a text editor)
- texniscope (a pdf viewer, good with pdflatex)
- adium (an IM client)



To make a backup on my external hard drive, named squall:

cd /Users/
rsync -EaH epg /Volumes/squall/

The -E option saves source forks, a mac way of storing certain data
The -a option puts it in archive mode. It will search recursively,
copying links, permissions, times, groups, owners, and devices.
The -H option preserves hard links.

Another possible command is: rsync -aH --delete [source] [destination]

With this option, if rsync sees that a file exist in the destination drive
that is not in the source drive, it will delete it. So, your backup is
cleaned up like your home system. HOWEVER - this can sting you if you
accidently deleted a file in your home system.




To find your IP address (while working remotely), type
ifconfig
Look for en1: ...
This will contain your inet address 128. . . .
This is the one to use!

I assume you can get your hardwired address this way too.



I downloaded openoffice.org 1.1.2 - the stable release for mac os-x

If the start up program doesn't work, the manual start is:

setenv DISPLAY localhost:0
setenv DYLD_LIBRARY_PATH /Applications/OpenOffice.org1.1.2/program:/Applications/OpenOffice.org1.1.2/program
sh soffice

(But the start up program worked for me!

Their is now a better version, 2.0.? - I downloaded it, and won't use this
older one anymore.



A nice IM client: adium (google it - you just grab the executable)

It runs AOL IM, and a few others. The AOL client, AIM, isn't as stable
isn't as nice!



To make vi a little nicer, with syntax highlighting, you need a
".vimrc" file in your home directory. Here's the one I've got so far.
I should be able to add colorschemes to get color highlighting (nice for
programing), but my efforts so far have proved futile.

GFDL:

syntax on
colorscheme delek
set tabstop=2
set autoindent
syntax enable

I must comment out the colorscheme request, as it can't find it. You
comment with a "

The math vimrc is much nicer. I'll use it, but with a few necessary
tweaks:
----

set nocompatible " Use Vim defaults (much better!)
set bs=2 " allow backspacing over everything in insert mode
"set ai " always set autoindenting on
"set backup " keep a backup file
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time

" Only do this part when compiled with support for autocommands
if has("autocmd")
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
endif

if has("cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif

if &term=="xterm"
set t_Co=8
set t_Sb=m
set t_Sf=m
endif

---
The tweaks were to comment out the if &t_Co line above, so that syntax
highlighting is always turned on. Then, I had to comment out
the final if statement, if &term=="xterm" because it was trying add
colors unsuccessfully.




I needed to download Stuffit 10.0 to decompress a .sit file.



With keynote, use latex equation editor for equations. See the latex stuff
file for details!






to set up my computer as an ssh server:

as root, first set up keys (these are not pass phrase protected,
because of the -N "" option)

(to become root, type su, or if that doesn't work, try sudo su)

ssh-keygen -b 1024 -t rsa -f /etc/ssh_host_rsa_key -N ""
ssh-keygen -b 1024 -t dsa -f /etc/ssh_host_dsa_key -N ""
ssh-keygen -d -b 1024 -f /etc/ssh_host_key -N "" -C "$(hostname)"

Then, I mades some important changes to this configuration file:
/etc/sshd_config

36c36
< #PermitRootLogin yes <-------- this was in the old file
---
> PermitRootLogin no <-------- this is what I changed it to
55c55
< #PermitEmptyPasswords no
---
> PermitEmptyPasswords no <-- make sure you don't get yourself in trouble
80c80
< #X11Forwarding no
---
> X11Forwarding yes <- allows you to tunnel windows, etc.


lastly, to run the server, type (must be root)
/usr/sbin/sshd

Note: you'll get an error message:
Disabling protocol version 1. Could not load host key

I was told that this is an earlier version of ssh. So you shouldn't have
a problem, unless the other computer you are using doesn't have the current
ssh version.

there's a way to make this start up automatically when you start the
computer, but I'd don't use it enough at this point



password stuff:

I'm not sure what root password was to begin with - my user account had
the same pa


to change root password,
as root: passwd

to change epg password, use either mac standard stuff, or, as root,
passwd epg

or you might, not as root, be able to say,
passwd






added ferret, fallowing andy jacobsen's web page
http://tazman.princeton.edu/osx/ferret.html

I got the ferret.tgz file, put it in my desktop, and did this to load it:

sudo tcsh
cd /usr/local
tar zxvf ~/Desktop/ferret.tgz


I had to fix the paths for bash, but the template
/usr/local/ferret/bin/ferret_paths_bash_template
seemed to work. I just copied it over to replace the tcsh ferret_paths file,
and tried to modify the call for the data - I'm not sure if I have it right.
But so far, so good.



Got ncview
http://meteora.ucsd.edu/~pierce/ncview_home_page.html

Now you can get it from fink! See Andy Jacobson's page, listed at the top.
Obsolete advice: first use fink to get the netcdf package. This is necessary to
get the right libraries for ncview.

Put it in my Applications directory. Followed the instructions in the
included README file. Seems to work fine, after I aliased it properly.
Don't try to load the ulibunits (?) package - it won't work on the mac!



I've got a pretty sweet .bashrc file, with sophisticated completions and
shortcuts to avoid typing & all the time to make applications that launch
new windows run in the background. I've got a copy of it in this directory,
as of today, 9/22/06. Check my most current version for the best fixes.



valuable program: screen

This allows you to run things on a shell, close it, go away, come back,
and reconnect from some other location, etc.

To start:
screen

ctrl-A tells screen that you're entering a screen command


ctrl-A A let's you rename a shell


ctrl-A c creates a new shell (you can rename it as above)

ctrl-A " list all your shells, and allows you select the one you want
to work with

ctrl-A K kill the current screen

ctrl-A d detach from all screen sessions (after this, you can go
away from all sessions)

To reconnect:
screen -R

This lets you go back to your sessions!

To stop annoying flashing when you try to use the tab button to make
complete file names, etc., make a .screenrc file in your home directory
that has this line,

vbell off


More information is available here:
http://gentoo-wiki.com/TIP_Using_screen