osx - updating a macports installed program to the most recent revision

06
2014-04
  • zhermes

    I general use macports to manage as much as I can---emacs, for example. Just now a fix was implemented in emacs for a bug that's been bothering me. Is it possible to incorporate the most recent emacs revision to my existing macports installation, or do I need to ditch the port, and install anew from (e.g.) the emacs git repository?

  • Answers
  • Mike Fisher

    This exact problem is why I switched from MacPorts to Homebrew, which lets me build a current Emacs with this command (--HEAD means from the bzr/git source code; --cocoa means that it builds the Cocoa framework version, like the emacs-app target from MacPorts):

    brew install --HEAD emacs --cocoa
    

    The Homebrew Emacs port maintainers track the current release of Emacs, so you can drop the --HEAD choice if a release is adequate.


  • Related Question

    osx - Macports, post-install and launchd: what were those instructions again?
  • kch

    When you install server software via MacPorts, when the installation is finished it prints some instructions about enabling the server via launchd.

    I promptly hit ⌘K on the Terminal and forget about it.

    Days later I want to actually enable said server.

    Is there any way to get those instructions again[1]?

    update:

    I wrote about launchd, and port load is great for that, but some ports have other instructions. I''d welcome a general answer. For example, git-core will print bash-completion setup instructions.

    Bonus question: On port load, is there a way to list which ports have launchd items?


    [1]: Without going through uninstall and reinstall, obviously.


  • Related Answers
  • mipadi

    Generally, you can load it with the port load command, in MacPorts 1.8. It takes the format port load $package. For example, to load the PostgreSQL server from the postgresql83-server port:

    $ sudo port load postgresql83-server
    

    For some older ports, the name of the port does not correspond to its associated launchd config file, and port load will fail (happens rarely, but occasionally). In this case,

    $ sudo launchctl load -w /Library/LaunchDaemons/$config_file_to_load
    

    will do the trick.

  • fideli

    EDIT
    Just to update on my general method for showing instructions for a given port, I just learned that you can type

    port notes slocate
    

    which returns:

    slocate's database should be updated on a regular basis. In
    /opt/local/etc/daily.slocate, you'll find some lines to put in
    /etc/daily.local to update the database on a daily basis (for example).
    If you want to disable the weekly update of the system's built-in locate,
    edit the file /etc/weekly.
    

    OLD
    A very crude way of doing is by reading the Portfile directly, and looking at the post-install section. Using slocate as an example:

    port cat slocate | grep ui_msg
    

    returns:

    ui_msg "\nslocate's database should be updated on a regular basis. In"
    ui_msg "${prefix}/etc/daily.slocate, you'll find some lines to put in"
    ui_msg "/etc/daily.local to update the database on a daily basis (for example)."
    ui_msg "If you want to disable the weekly update of the system's built-in locate,"
    ui_msg "edit the file /etc/weekly.\n"
    

    As you can see, the output from port cat is not formatted as nicely BUT should give you enough information. Hope this helps!

  • Nerdling

    Starting with MacPorts 1.8.2 (that is, you must use the trunk version presently) there is a logging mechanism. You are able to reference everything that was printed in log files.

    port log is available, and has switches for showing phases among other things. Please check the man page when you've installed the trunk version of MacPorts.

    Also, this might point to what port owns what Launchd plist file:

    for i in /Library/LaunchDaemons/*; do echo -n "$i: "; port provides "$i"; done