Posts tagged macports

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 >

Macports fails to compile p5-perlmagick

If you need PerlMagick on a Mac, there was (and still is) a p5-perlmagick package. If you try to install that package now, you’ll find it doesn’t compile (!!). You don’t have to resort to compiling from source, though.

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)

How to Convert Your Book’s Images to Kindle

Taking your painstakingly typeset book and shoving it through the kindle “conversion” meatgrinder was an exercise in wincing. Most of the images were corrupted, there was whitespace sprinkled randomly throughout the copy, and it was a general mess.

Kindle supports direct upload of an html version of your book, but there’s a lot of finessing you need to do before it all goes smoothly. One of the tasks you’ll need to do is convert your book’s images to greyscale, and reduce their size to something Kindle-friendly. There are free tools to help you do this if you aren’t afraid of the terminal.

More >

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.

How to set up native subversion (javahl) with Subclipse on Mac OS X

Note that this is for Ganymede (Eclipse 3.4.x).

  1. Install the javahl binding with MacPorts:
    sudo port install subversion +bash_completion
    sudo port install subversion-javahlbindings
    
  2. Run eclipse, and add this upgrade site: http://subclipse.tigris.org/update_1.4.x
  3. Select the “JavaHL Adapter” and “Subclipse” modules and click “Install”
  4. Choose Eclipse > Preferences…, go to Team > SVN, find the “SVN Interface” pulldown, and choose “JavaHL”

Quick MacPorts Installation of Ruby on Rails

I finally got to walking through a great gentle introductory ALA article on Ruby on Rails. I wanted to run rails Demo to build my first project, but I got nastiness:

$ rails -v
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:379:in `report_activate_error': RubyGem version error: rake(0.7.3 not >= 0.8.3) (Gem::LoadError)
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:311:in `activate'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:337:in `activate'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:336:in `each'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:336:in `activate'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:65:in `active_gem_with_options'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:50:in `gem'
        from /usr/bin/rails:18

That’s not especially welcoming. Let’s see if MacPorts can come to the rescue.

After installing MacPorts, this got me going:

sudo port selfupdate
sudo port install rb-rubygems
sudo gem install rails

I saw this from the gem install rails:

Successfully installed rake-0.8.3
Successfully installed activesupport-2.2.2
Successfully installed activerecord-2.2.2
Successfully installed actionpack-2.2.2
Successfully installed actionmailer-2.2.2
Successfully installed activeresource-2.2.2
Successfully installed rails-2.2.2
7 gems installed
Installing ri documentation for rake-0.8.3...
Installing ri documentation for activesupport-2.2.2...
Installing ri documentation for activerecord-2.2.2...
Installing ri documentation for actionpack-2.2.2...
Installing ri documentation for actionmailer-2.2.2...
Installing ri documentation for activeresource-2.2.2...
Installing RDoc documentation for rake-0.8.3...
Installing RDoc documentation for activesupport-2.2.2...
Installing RDoc documentation for activerecord-2.2.2...
Installing RDoc documentation for actionpack-2.2.2...
Installing RDoc documentation for actionmailer-2.2.2...
Installing RDoc documentation for activeresource-2.2.2...

I had some issues because my PATH included /usr/bin before /opt/local/bin (so MacOS’s old gem binary got picked up before MacPorts’ version). You can tell you’re running the correct version:

$ which gem
/opt/local/bin/gem
$ gem -v
1.3.1

If you see version 1.0.1, you’re still need to follow these instructions to install MacPorts. Add something like this to your ~/.bashrc or ~/.profile:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Anyway, looks like things are good now. Yea new toys.

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.

Automatic panoramas with hugin and autopano

I’ve only been using hugin for an hour now, and I’m really impressed.

The mac binary doesn’t include the ability to automatically determine how images overlap, but it’s pretty easy to make that work, too.

First download the hugin binary. The Mac OS X port is here.

Then install the autopano binary.

First install MacPorts.

Then run:

sudo port selfupdate
sudo port install autopano-sift-c

I had a problem with cmake hanging during install. If port stalls for you, ctrl-c, then sudo port clean cmake ; sudo port install cmake ; sudo port install autopano-sift-c again.

Then tell Hugin where the binary is. Go to Hugin > Preferences… and click the “Autopano” tab, and make it look like this:

Close the preferences window, and the next time you use the “Assistant” tab and load images, you’ll see that the alignment is done for you automatically.

Here’s an example taken from Bryce Point in Bryce Canyon: (it’s also one of the banners).

Ant bash completion on Mac OS X

bash will do tab-completion for ant targets on Debian/Ubuntu boxes out-of-the-box. If you haven’t upgraded lately, you may need to:

sudo apt-get install bash-completion

On Mac OS X, it needs a bit of massaging. First install the macports version of bash-completion and ant:

sudo port install bash-completion apache-ant

Then add this to the end of your ~/.bashrc:

if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
complete -C /opt/local/share/java/apache-ant/bin/complete-ant-cmd.pl ant

See http://marius.scurtescu.com/2005/03/23/ant_bash_completion for Windows instructions.