Lion Upgrade -- Recovering mac ports, ncurses and mongodb

Lion ate my mac ports install. On the other hand, mac ports has never been very robust when it comes to operating system upgrades.

Earlier this week, I did a time machine restore to a new mac book pro from an (much older) mac book pro -- I spent the next four hours or so recovering and rebuilding my XCode and mac ports environment.

So, it wasn't really that much a surprise to see that my mac ports installation failed to selfupdate or upgrade outdated following the Lion OS update.

The first thing I had to do was grab the new (OX X 10.8) version of XCode from the Apple AppStore.  This, as it turned out, was a bit of a challenge.  I couldn't see to get the new rev to download from the AppStore and, Apple being Apple, there's no such thing as  a mirror site.   Long story short, it took about 36 hours of repeated download requests/attempts to get the upgrade downloaded.

Once I installed the XCode update, the next step was to re-build mac ports from scratch.

[cc lang='bash' line_numbers='false']

# sudo svn checkout http://svn.macports.org/repository/macports/trunk

# cd trunk/base

# sudo ./configure --enable-readline

# sudo make install

# sudo make distclean

# sudo port -v selfupdate

# sudo port upgrade outdated


...and this is where I started getting a lot of errors...  Basically, ncurses was failing to install returning with a shell-error command.  If I tried to install individual packages that depended on ncurses like, say, mongodb, then I got returned to this error.

About 30 minutes of reading in the mac ports bug filings, and I learned that there is an issue between ncurses -> libiconv -> gawk.  The tl;dr of the issue is (if I remember right) that libiconv was looking for awk and finding gawk and wasn't building.  Since it didn't build, then nurses won't build, and if ncurses won't build, you're pretty much screwing the pooch on your mongodb install.

So, through trial-and-error, and you may have to repeat the sequence, I figured out the following commands to get all the innards back into the stomach of mac ports:

(note: either sudo these commands or exec as root.)

  1. port clean gawk
  2. port uninstall gawk
  3. port clean libiconv
  4. port uninstall libiconv
  5. port install gawk
    1. this will automagically reinstall libiconv
  6. port clean ncurses
  7. port install ncurses

This should result in a clean build and installation of ncurses.  Earlier in the process, since ncurses is dependent on ncursesw, I cleaned, uninstalled, and installed ncursesw.  But I'm not convinced that was a necessary step.  If the above process is failing for you, then maybe you should try r&r'ing ncursesw first.

I'm still having issues with mongodb...and I'll document the solutions as I figure them out -- but the ncurses dependency is, for the moment, addressed.

[cc lang='bash' line_numbers='false']

In file included from util/processinfo_darwin.cpp:30:
/usr/include/mach/shared_memory_server.h:48:2: warning: #warning "<mach/shared_memory_server.h> is deprecated.  Please use <mach/shared_region.h> instead."
In file included from util/processinfo_darwin.cpp:23:
/usr/include/mach/task_info.h:252: error: 'vm_extmod_statistics_data_t' does not name a type
/opt/local/include/boost/system/error_code.hpp:214: warning: 'boost::system::posix_category' def


And I see there's a bug reported for this issue with the comment that they're kicking it over to the folks at mongodb for a fix.

Stay tuned...

[Edit 8/1/2011]

I did a Lion upgrade on a fresh Leopard system - there's been some changes since I wrote the article, most notably, the problems with ncurses, gawk, et. all., seemed to have been fixed.  The steps are pretty simple, actually:

  1. download (holy constipated broadband! anyone else notice the slow-as-frozen-cement download speeds Apple squicks out for this application?)  and install XCode for Lion from Apple's AppStore application.
  2. check and, if necessary, modify your PATH variable to include the mondodb bin path (for me: /opt/local/bin).
  3. self-update the mac port install  (sudo port selfupdate)
  4. update the outdated ports  (sudo port upgrade outdated)
  5. Follow the steps left by Peter in the comments below to patch and install mongodb.  (Thank-you, Peter!)
Once I did this, I had a fully-functional port installation, complete with mongodb and all the other cool kids. (Apache2, mysql5, php5, etc.)
Hope this helps!

OS X Lion - First Looks

I downloaded Lion, Apple's latest upgrade to Mac OS X yesterday afternoon.  I used my work connection to do so and completed the download in about 20 minutes.  When finished, I had a new application installed named "Install Mac OS X Lion" in my /Applications folder.  I burned it to a DVD and scurried home to install the upgrade on my 27" I7 iMac.

What follows are some first impressions about the new operating system.  This is just the kinks and quirks that I've discovered.  If you want a painfully in-depth review, I suggest the Ars-Technica review.  All 20 pages worth.

I was somewhat worried about the install as I'd heard, through co-workers, that there were problems with the install and that your system had to absolutely be up-to-date with the latest software upgrades in order for the installation to be seamless.  So, I ensured that, before installing, I hit software-update off the main menu and installed everything Apple recommended that I install.

That took about a half-hour because there were a lot of 10.8 updates (iTunes, iWhatever) to install.  When that finished, I copied over the "Install Mac OS X Lion" folder from the DVD into my Applications folder and double-clicked.

It took about three minutes for the installation prelims to sort themselves out.  Then my machine re-started itself and began the install in earnest.  It informed me that I had about 30 minutes to go.  Watching the progress bar tick across isn't all that absorbing, and Sarah had a chicken wings cooking, so I left the upgrade to it's own fate and left to go scarf a couple pounds of her awesome chicken wings.

When I returned, the computer had finished the install and was displaying the Lion login screen waiting for me to sign-in.  I did so, and was presented with the new welcome dialog box and the new-ish desktop.  So far, so good....and, uh-oh.  Up popped a dialog box telling me that Lion had detected incompatible software on my system and had removed said software to a folder called "Incompatible Software" on my install drive.

I had two programs in this folder - one I don't use anymore, can't remember what it was called, and really didn't care.  The other was visor, my terminal program hider which I did, very much, care about.  I checked the author's website and, sure enough, a replacement program was already available for download and installation.

I didn't have a lot of time to play with the new OS, but this is what I learned in the hour or so that I did have.

-- I crashed terminal once, after SSH'ing into a remote server.  The crash report popped and I sent it off to Apple.  I relogged into the remote server and it's not crashed since.

-- Safari failed to display the Netflix plug-in necessary to display/run/show movies.  Chrome worked without issue.

-- The new email program is really cool.  A lot like the iOS mail program in terms of the UX.

-- I have a dual-boot set-up with Windows 7 running off another partition on the same drive.  After installing Lion, I checked and tested and the partition was accessible and stable.  (As stable as Win7 can be at any rate.)  The only difference I noted was that, before since Win 7 was the last OS installed, it booted by default; I had to hold-down the option key to boot into Mac.  Now, Lion boots by default and I hold down the option key to select the Win 7 bootable partition.

-- I have a recovery partition now in addition to the Win 7 and Lion partitions...I had read about this in the Ar review so no surprise.  It's nice to see that I have this parachute though in case things really head south.

-- Not sure if all my mac-ports software will still function.  I do some development at home and I know that whenever you change OS versions, you have to pretty much R&R ports which is a real pain in the patoot.  I'll need to test this later today when I get home...

-- The application formerly known as spaces is very new, interesting, and will take some getting used to.  Overall, I prefer the new UX.

Everything at this stage is superficial as I've not checked CPU burn or memory usage.  Does it feel faster?  Ah, meh.  I've not run any serious apps under it so I can't say at this point.  As I explore more, I'll share what I discover...

[Edit: July 22, 2011]

Mac Ports is definitely broken.  It requires a re-install of Xcode which is, in itself, a total pain in the ass apparently to download and install.  I've been trying now for over a day to get Apple to push this application down to me and it's only been in the last hour that I've started to see some bits and bytes squick down the line to me.  You can only install this app from the AppStore, unfortunately.

(And, while I'm thinking of it -- why the hell do I have to keep plugging in my AppStore password every single goddamn time I access the store?  Wasn't there a reason you had me store this information?  (System Preferences -> MobileMe?)  FFS, Apple, one of the reasons why the Android Market is so much better than the iPhone AppStore is that I'm not forced to enter my password each and every time I want to do something.)

Anyway, when I tried to update ports, I got errors.  So I checked-out the source and went to build from source and was informed that I don't have a worthy C-compiler installed.  You *have* to download the XCode package for Lion and install that first.

Also, I cannot recover my Lion install from sleep mode.  Key presses, power-button flicks, mouse shaking, nothing seems to work other than a hard re-boot.  I called Apple Support and scheduled a call -- which was incredibly unsuccessful.  I was advised to try the following:

-- turn off your computer and remove the power cord for 15 seconds.  Me:  Why?  How is this different from shutting off all power to the computer during a reboot?  Them:  Well, it's different if there's no power to the computer.  Me:  Oh.  So, when I shut off the computer by holding down the power button for 5-seconds, and it goes black, it really continues to run?  Them:  Uh, no.  It's, ah, just better to not have power.

-- boot from the restore partition and run the equivalent of fixperms (reset all file/directory file permissions on the filesystem)  Me:  You're saying that Lion messed up my permissions during installation?  It was working, I installed Lion, it's not working, and you're telling me file permissions are keeping my computer from waking from sleep?  Them:  Uh, no - this is just what it says on the support forums.  (Thank you, Support Forums, for not suggesting that immersing my computer in water is also a solution.)

-- Reset the pROMS by booting holding down option-R until it beeps twice. Me:  Are you serious? How about you just acknowledge this as a hardware-interrupt driven software failure and tell me you'll file the bug and send me on my way?  Them:  Uh, can you send in your system report, please?

Jeez.  What a waste of time that was...