Monday, August 13, 2012

MacPorts trouble with OS X Lion


It's a llama and an ass.


Recently I had trouble using MacPorts on Lion, for whatever reason. But I managed to find the fix, and here they are.
  1. Unable to do selfupdate:


    ~$ sudo port selfupdate
    ---> Updating MacPorts base sources using rsync
    MacPorts base version 2.0.4 installed,
    MacPorts base version 2.1.2 downloaded.
    ---> Updating the ports tree
    ---> MacPorts base is outdated, installing new version 2.1.2
    Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl

    Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: shell command failed (see log for details)

    Cause: ??? (shame on me for not checking the logs)
    Solution: Re-install Xcode (ref: MacPorts ticket #30507).
    Before re-installing Xcode, I had to uninstall my existing one. All I did was:
    1. Search for the Xcode executable from Spotlight
    2. Open the folder where the Xcode executable is (usually under /Applications).
    3. Drag the icon to the Trash bin. OR drag the Launcher icon to the Trash bin (this will prompt for are-you-sure-you-want-to-uninstall? confirmation). Click Yes/OK if asked.
    Unfortunately, I wasn't 100% sure my method of uninstalling Xcode is correct. So here's a most-likely-more-proper-way reference from StackOverflow: #6777462 - Can't Reinstall Xcode
    If you're able to successfully re-install XCode (mine was 4.4.1 as of this writing), you should be able to run ~$ sudo port selfupdate successfully.

    p.s. Actually, I also installed MacPorts 2.1.2 manually (go to MacPorts website, download the .dmg, install, etc.). So now I'm not entirely sure which fixed it.
  2. Unable to install Octave


    ~$ sudo port install octave
    Warning: The Command Line Tools for Xcode don't appear to be installed; most ports will likely fail to build.
    Warning: See http://guide.macports.org/chunked/installing.xcode.html for more information.
    Error: Unable to open port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?
    Error: Unable to execute port: upgrade perl5 failed

    Cause: (the error message was pretty explanatory on this one) "The Command Line Tools for Xcode don't appear to be installed" and (hence) "Failed to locate 'make' in path".
    Solution: Install the XCode Command Line Tool.
    1. Launch XCode.
    2. In XCode, go to: Preferences > Downloads
    3. Click "Install" for the "Command Line Tools" item (the screenshot shows that it's already installed).


    Currently I'm still unable to install octave because MacPorts failed to install gnuplot, but it's not the error above - so that's an improvement. It may be missing some dependencies...

    p.s. Prior to installing the Command Line Tools, I ran across this post: "GCC non-existent in Lion". So I also did what was recommended there: made a symbolic link to llvm-gcc-4.2 to /usr/bin/gcc. But the location of the newest Xcode directory in my system is a little different:

    ~$ sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 /usr/bin/gcc

Monday, March 26, 2012

VirtualBox and The Pesky Shared Folder

VirtualBox and Shared Folders

What I learned: if you want full access to your shared folder on VirtualBox, do manual mounts.


System:
Host: Mac OSX 10.7 (a.k.a. "Lion")
Guest: Ubuntu 11.10 (a.k.a. "Oneiric Ocelot")
VirtualBox version: 4.1.10 r76795
VirtualBox Guest Addition version: 4.1.10
Shared Folder name: ~/sharedfolder

Case:
I need to rebuild a database in the guest OS. The database dump is stored in the shared folder (due to limited space in my .vdi), and I need to use it to rebuild the database.

Issue:
I used the command:
~$ sudo su postgres -c "psql -d < path-to-shared-folder/database.pgdump"

Result:
after entering root password, it returned:
"Permission denied"

I checked the permission on the shared folder and the dump file. The file's permission was:
-rwxr-x---

I tried changing the permission to no avail.

Solution: manual mount!

  1. Create a new folder in your HOST system. e.g. ~/sharedfolder
  2. Add the folder to your VirtualBox Guest OS shared folder list
    1. To access the Shared Folders option: select your guest OS > Settings > Shared Folders
    2. Add your shared folder. Make sure NOT to check "Auto-mount" (it's evil). Then click "OK".
  3. Run your guest OS. The following instructions are for Ubuntu only (sorry!).
  4. In your guest OS, create the directory you want the shared folder to be mounted to. For example: /mnt/shared
  5. Open a Terminal and mount your shared folder
  6. Et voila, your file (if you have any in the shared folder) will have the following permission:
    -rwxr-xr-x 1 root root
Only after doing the manual mount, I was able to use the .pgdump file to rebuild the database. Prior to that, it's just a bunch of "Permission denied", "Wrong protocol", "file or folder not found", etc. I can't say whether or not this would work if you want to use a shared folder you already used with Auto-mount. I had to create a new folder for it to work. Let me know if you had a different experience/luck. Signing off...

Tuesday, March 6, 2012

iPadHD = iP+ADHD

The new iPad will be called iPadHD:
i - P - Attention Deficit Hyperactivity Disorder (ADHD)

What is ADHD?