Posts tagged mac

Speed up Firefox!

My Firefox on Mac was getting pretty lethargic — almost a minute to spin up, and multiple seconds to just open a new tab. I installed the new beta of Google Chrome, and remembered how nice a speedy browser was.

Google Chrome for Mac is a nice first effort, but without custom search engines, and all the other firefox add-ons, the shininess gets pretty tarnished. I needed my fast firefox back!

I made just a couple changes, though, and my Firefox is back to it’s prior speedy self!

More >

How to bounce an application with Applescript

Say, for whatever reason, you want to bounce iphoto once an hour. You can do that with AppleScript and cron.

More >

Download Xcode 3.1.4 for Leopard

Apple’s developer website only links to the latest version of Xcode, which requires Snow Leopard (Mac OS X 10.6).

If you’re still running Leopard (10.5), you need to go to this alternative developer website:

http://connect.apple.com/

Log in with your ADC credentials, click “Downloads”, then click “Developer Tools” in the right sidebar, and then search the page for “3.1.4″. You might also want to check the wikipedia list of xcode versions to see if 3.1.4 is still the latest version.

(reference)

Apache2, PHP, and MySQL on Mac OS X using MacPorts

1. Install MacPorts

Follow the instructions here: http://www.macports.org/install.php.

2. Install apache2

sudo port install apache2

Note that the macports instructions suggest installing the launchctl script now, but we’ll do that after mysql and php are installed.

3. Install and configure MySQL

If you want 5.0.x, use mysql5-server. If you need 5.1.x, install mysql5-server-devel (at least as of August 2009).

sudo port install mysql5-server

As the macports instructions state,

In order to setup the database, you might want to run sudo -u mysql mysql_install_db5 if this is a new install.

It’s never a bad idea to set the root password, and as the document suggests, run:

/opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'

You also want to install a database configuration file — there are a bunch of templates in /opt/local/share/mysql5/mysql/, but for development, my-small.cnf should suffice:

sudo cp /opt/local/share/mysql5/mysql/my-small.cnf /opt/local/etc/mysql5/my.cnf

Once the config is in place, spin up mysql:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist

Check that mysql is up and running by connecting with the mysql client:

mysql -h localhost -u root -p

4. Fix your PATH

Note that the mysql binaries in /opt/local/bin all have a “5″ suffix, but /opt/local/lib/mysql5/bin has “normal” named binaries, so you probably want that in your PATH too. The apachectl in /usr/bin will spin up the mac os x version of apache (that we’re avoiding), and that lives in /opt/local/apache2/bin. So in your .bashrc (or .profile or whatever):

export PATH=/opt/local/bin:/opt/local/sbin:/opt/local/lib/mysql5/bin:/opt/local/apache2/bin:$PATH

5. Install PHP5

sudo port install php5 +pear +apache2 +fastcgi +mysql5

Note that php5 has a lot of variants. If you think you want other goodness, run port variants php5 and cook up your own set of options.

Again, as the macports instructions state,

copy /opt/local/etc/php5/php.ini-development (if this is a development server) or /opt/local/etc/php5/php.ini-production (if this is a production server) to /opt/local/etc/php5/php.ini and then make changes.

6. Install the PHP-MySQL driver:

sudo port install php5-mysql +mysql5

7. Configure apache2

The mod_php.conf from the php5 package is put into a directory that the apache2 configuration doesn’t read by default — so you need to add this line to the end of /opt/local/apache2/conf/httpd.conf:

Include conf/extras-conf/*

Hopefully this will be considered a packaging bug, and will be fixed at some point.

8. Run apache2

sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

Note that the logs, by default, are in /opt/local/apache2/logs.

If you change the PHP or Apache configuration files, run

sudo /opt/local/apache2/bin/apachectl restart

and watch the logs for errors.

Using Mac OS X 10.5’s keychain for ssh

The version of ssh that comes with Mac OS X 10.5.6 has a -K option that stores your passphrases in your system’s keychain.

Run this:

ssh-add -K [path to private keyfile]

Provide your passphrase once when asked, and keychain will provide the passphrase for you automatically. You should probably enable “Require password to wake this computer from sleep or screen saver” in the Security pane of the System Preferences if you decide to do this.

If you see

$ ssh-add -K
ssh-add: illegal option -- K

it’s because you’re using the macports (or fink) version of ssh. (run ‘which ssh’ to find out). With macports, uninstall the “openssh” package:

sudo port uninstall openssh

The ‘-K’ option was discovered courtesy of http://www-uxsup.csx.cam.ac.uk/~aia21/osx/leopard-ssh.html.

http://kimmo.suominen.com/docs/ssh/ has some excellent ssh documentation.

Viscosity and Search Domains

I’ve really enjoyed Viscosity as my openvpn client for Mac OS X (instead of Tunnelblick). It’s stable, bounces back after system sleep, and is well supported.

After upgrading from 1.0.3 to 1.0.4, I found that my search domain configuration from the Network Settings control panel wasn’t being respected anymore while the VPN was up. I got the following reply (in 30 minutes, no less):

The 1.0.3 behavior was actually a bug (your system should use any search domains associated with the VPN connection for security reasons, rather than local search domains).

You can specify search domains to use while connected instead like so:

1. Edit your connection in Viscosity
2. Click on the Advanced tab
3. Add the command “dhcp-option DOMAIN mydomain.com” (no quotes) where mydomain.com is your search domain
4. Repeat step 3 for each search domain you have
5. Click Save and try connecting

These instructions worked perfectly. Thanks!

Skype Beta for Mac 2.8 has screen sharing

Skype Beta for Mac OS X version 2.8 adds screen sharing, and it’s easy to use — but screen sharing is only available on the Mac version of Skype.

Until they port screen sharing to Windows and Linux, teamviewer and VNC will have to make do.

TaskPaper is All Sorts of Awesomeness.

I finally got around to trying out TaskPaper (one of the apps I got from MacHeist a while ago), and it’s a brilliant and simple todo app.

You enter something like this:

Inbox:
- Put camera in car
- Put pizza stone in car
Groceries:
- Milk
- Eggs
- Pizza toppings
Yard work:
- Rake leaves
- Put away hose @done
- Clean up garden @done

And you get a GUI treatment that looks like this:

It’s one of my must-have applications now.

Accessing git over ssh on a non-standard port

Simple ssh access to a git repo can be sufficient for a small dev team–but what if you’re using a non-standard ssh port?

The solution–do as Linus says. Use ~/.ssh/config.

My config now looks like this:

Host my.servername.org
  Port 1234

Remember that ~/.ssh needs to be 700 (read/write/execute for only the owner), and the files inside are all 600:

$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/*

Installing git with MacPorts

The Good: MacPorts makes git, the new source version control system hotness, available to Mac users.

The Bad: MacPorts sometimes has attitude, and poops out trying to compile or install packages.

The Ugly: MacPorts doesn’t tell you how to fix it.

So here was what I saw:

mrm@whack:~$ port search git
cogito     devel/cogito   0.18.2   Git core and cogito tools to provide a fully-distributed SCM
git-core   devel/git-core 1.6.0.4  A fast version control system
qgit       devel/qgit     2.2      A graphical interface to git repositories
stgit      devel/stgit    0.14.3   Push/pop utility on top of GIT
cgit       www/cgit       0.8      A fast web interface for the git source code management system

Great. I’ll install git-core. What additional goodies are there?

mrm@whack:~$ port info git-core
git-core 1.6.0.4, devel/git-core (Variants: universal, doc, gitweb, svn, bash_completion)

http://git.or.cz/

Git is a fast, scalable, distributed open source version control system focusing on speed and efficiency.

Library Dependencies: curl, zlib, openssl, expat, libiconv
Runtime Dependencies: rsync, perl5.8, p5-error
Platforms: darwin
Maintainers: bryan@larsen.st maccheck@gmail.com openmaintainer@macports.org

OK, so I want svn and doc and bash_completion extras:

mrm@whack:~$ sudo port install git-core +svn +doc +bash_completion +gitweb
...
Error: Target org.macports.fetch returned: fetch failed
Error: The following dependencies failed to build: p5-svn-simple subversion-perlbindings subversion p5-term-readkey rsync popt
Error: Status 1 encountered during processing.

So we’re now at the bad and ugly. When ports cops attitude, run these two commands:

sudo port selfupdate
sudo port upgrade outdated

and wait. If there are any failures, look at the package that failed, and restart the installation of that package. Once that’s completed, re-do the original port install git ... command.