To make a mac behave more like it’s underlying BSD brethren, especially hacking from the command line, and the normal tools you really need to make things suck less.
|command||what it does|
|find . -name whatever.py||finds the whatever.py file|
use Mac command line tools
If you want to work from the command line and have all your normal build environment, it’s a pain in the butt on Mac (compared to Linux/BSD=1 command), even though Mac is based on BSD. I have no idea why they do this, but hey, this is Mac.
1. Download XCode from app store. It’s friggin’ HUGE, like almost 2GB (just to get the tiny few Kb files you really need, yeeeeah). Oh, and you have to sign in with your account to get these free tools. Sheesh.
2. You’re still not there yet, because you have to tell Mac to actually USE them from the command line (seriously), so you do:
3. Launch XCode -> Preferences -> Downloads -> Components and click the little download arrow to the right of “Command Line Tools”. Once it downloads you have to then tell the command line to use them, so:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer ls /usr/bin/make
if it worked, you should see ‘/usr/bin/make’ there now and be able to use it.
Install Mac Ports
This means you can use the normal command line tools and get updates through the port utility…sort of like apt-get or yum but for Mac. There’s a good guide here too. First, you have to download the latest version of macports from here. The double-click the package and use the default “easy” install. Now to see if it works, open a terminal and do:
port version Version: 2.3.1
here are some examples of how to use it now to do updates, install stuff, etc:
port selfupdate <-- gets the latest version of updates MacPorts base version 2.2.1 installed, MacPorts base version 2.3.1 downloaded. ---> Updating the ports tree ---> MacPorts base is outdated, installing new version 2.3.1 Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl The ports tree has been updated. To upgrade your installed ports, you should run port upgrade outdated port upgrade outdated <-- updates all your ports, could take awhile xcode-select --install <-- you might have to install this, if you get an error like: Warning: The Xcode Command Line Tools dont appear to be installed; most ports will likely fail to build. Warning: Install them by running `xcode-select --install`. (this will take awhile to download/install, and you will have to give permission on the gui to do it) port search minicom <-- search for whatever package you want to install minicom @2.6.2 (comms) Menu driven communications program port install minicom <-- downloads and installs minicom port info minicom minicom @2.6.2 (comms) Variants: universal Description: Minicom is a menu driven communications program. It emulates ANSI and VT102 terminals. It has a dialing directory and auto zmodem download. Homepage: http://alioth.debian.org/projects/minicom Build Dependencies: pkgconfig Library Dependencies: gettext Runtime Dependencies: kermit, lrzsz Platforms: darwin License: GPL-2 Maintainers: firstname.lastname@example.org
To uninstall something, like if selfupdate our outdated upgrades breaks on a package do:
port clean glib2
The next time you do an update it will re-install the latest version.
vi syntax highlighting
By default this is not enabled, so you enable it by adding lines to vimrc like:
vi /usr/share/vim/vimrc (add the following lines below the: set backspace=2 line) set ai " auto indenting set history=100 " keep 100 lines of history set ruler " show the cursor position syntax on " syntax highlighting set hlsearch " highlight the last searched term filetype plugin on " use the file type plugins " When editing a file, always jump to the last cursor position autocmd BufReadPost * \ if ! exists("g:leave_my_cursor_position_alone") | \ if line("'\"") > 0 && line ("'\"") <= line("$") | \ exe "normal g'\"" | \ endif | \ endif
now edit a file and it will show you color syntax hints…nice.