tail -f /dev/null

If you haven't had any obstacles lately, you're not challenging. be the worst.

YosemiteでMacportsが動かない & cmakeがインストールできない

$ sudo port selfupdate

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
Error: Current platform "darwin 14" does not match expected platform "darwin 13"
Error: If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration
OS platform mismatch
    while executing
"mportinit ui_options global_options global_variations"
Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch

Migration – MacPorts

上記を参照しながら、Macportsを再度インストールします。

command line toolsをインストールします。

$ xcode-select --install

ライセンスに同意します。

$ sudo xcodebuild -license

次に以下から、Yosemite用のmacportsパッケージをインストールします。

The MacPorts Project -- Download & Installation

portコマンドが使えるようになりますので、アップデートします。

$ sudo port selfupdate
Password:
--->  Updating MacPorts base sources using rsync
MacPorts base version 2.3.2 installed,
MacPorts base version 2.3.2 downloaded.
--->  Updating the ports tree
--->  MacPorts base is already the latest version

The ports tree has been updated. To upgrade your installed ports, you should run
  port upgrade outdated

$ sudo port upgrade outdated
Password:
http://mse.uk.packages.macports.org/sites/packages.macports.org/apache2
--->  Fetching distfiles for apache2
--->  Attempting to fetch httpd-2.2.29.tar.bz2 from http://apache.pesat.net.id/httpd
--->  Verifying checksums for apache2
--->  Extracting apache2
--->  Applying patches to apache2
--->  Configuring apache2
--->  Building apache2
--->  Staging apache2 into destroot
--->  Creating launchd control script
###########################################################
# A startup item has been generated that will aid in
# starting apache2 with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo port load apache2
###########################################################
Warning: apache2 installs files outside the common directory structure.
--->  Installing apache2 @2.2.29_0+preforkmpm
--->  Cleaning apache2
--->  Computing dependencies for apache2
--->  Deactivating apache2 @2.2.27_0+preforkmpm
--->  Cleaning apache2
--->  Activating apache2 @2.2.29_0+preforkmpm
--->  Cleaning apache2
Warning: Uninstall forced.  Proceeding despite dependencies.
--->  Deactivating libxml2 @2.9.1_0
--->  Unable to deactivate libxml2 @2.9.1_0, the following ports depend on it:
--->   libcroco @0.6.8_0
--->   libgsf @1.14.30_0
--->   py27-libxml2 @2.9.1_1
--->   libxslt @1.1.28_0
--->   shared-mime-info @1.3_0
--->   libarchive @3.1.2_0
--->   xorg-xcb-proto @1.11_0+python27
--->   librsvg @2.40.4_0+viewer
--->   gtk-doc @1.21_0+python27
--->   php54 @5.4.33_0+libedit
--->   php54-apache2handler @5.4.33_0
--->   ImageMagick @6.8.9-8_0+x11
Warning: Deactivate forced.  Proceeding despite dependencies.
--->  Cleaning dbus
--->  Uninstalling dbus @1.8.6_0
--->  Cleaning dbus
--->  Computing dependencies for dbus
--->  Installing dbus @1.8.6_0
--->  Activating dbus @1.8.6_0

############################################################################
# Startup items have been generated that will aid in
# starting dbus with launchd. They are disabled
# by default. Execute the following commands to start them,
# and to cause them to launch at startup:
#
# sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist
# launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist
############################################################################

http://mse.uk.packages.macports.org/sites/packages.macports.org/python27
--->  Fetching distfiles for python27
--->  Attempting to fetch Python-2.7.8.tar.xz from http://www.python.org/ftp/python/2.7.8/
--->  Verifying checksums for python27
--->  Extracting python27
--->  Applying patches to python27
--->  Configuring python27
--->  Building python27
--->  Staging python27 into destroot
--->  Installing python27 @2.7.8_3
--->  Cleaning python27
--->  Computing dependencies for python27
--->  Deactivating python27 @2.7.8_2
--->  Cleaning python27
--->  Activating python27 @2.7.8_3

To make python 2.7 the default (i.e. the version you get when you run 'python'), please run:

sudo port select --set python python27

--->  Cleaning python27
--->  Fetching archive for dbus-python27
--->  Attempting to fetch dbus-python27-1.2.0_0.darwin_14.x86_64.tbz2 from http://jog.id.packages.macports.org/macports/packages/dbus-python27
--->  Attempting to fetch dbus-python27-1.2.0_0.darwin_14.x86_64.tbz2 from http://packages.macports.org/dbus-python27
--->  Attempting to fetch dbus-python27-1.2.0_0.darwin_14.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/dbus-python27
--->  Computing dependencies for dbus-python27
--->  Fetching distfiles for dbus-python27
--->  Attempting to fetch dbus-python-1.2.0.tar.gz from --->  Computing dependencies for p5.12-getopt-long
--->  Fetching distfiles for p5.12-getopt-long
--->  Attempting to fetch Getopt-Long-2.42.tar.gz from Warning: Uninstall forced.  Proceeding despite dependencies.
--->  Deactivating p5.12-getopt-long @2.420.0_1
--->  Unable to deactivate p5.12-getopt-long @2.420.0_1, the following ports depend on it:
--->   intltool @0.50.2_3+perl5_12
Warning: Deactivate forced.  Proceeding despite dependencies.
--->  Cleaning p5.12-getopt-long
--->  Uninstalling p5.12-getopt-long @2.420.0_1
--->  Cleaning p5.12-getopt-long
--->  Computing dependencies for p5.12-getopt-long
--->  Installing p5.12-getopt-long @2.420.0_1
--->  Activating p5.12-getopt-long @2.420.0_1
--->  Cleaning p5.12-getopt-long
--->  Fetching archive for p5.12-pathtools
http://jog.id.distfiles.macports.org/macports/mpdistfiles/cmake
--->  Verifying checksums for cmake
--->  Extracting cmake
--->  Applying patches to cmake
--->  Configuring cmake
Error: org.macports.configure for port cmake returned: configure failure: command execution failed
Please see the log file for port cmake for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/main.log
Error: Unable to upgrade port: 1
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
$ sudo port -u uninstall
Password:
--->  Uninstalling apache2 @2.2.27_0+preforkmpm
--->  Cleaning apache2
--->  Uninstalling openssl @1.0.1i_0
--->  Cleaning openssl
--->  Uninstalling sqlite3 @3.8.6_0
--->  Cleaning sqlite3

依存関係のエラーが多く、コマンドの実行エラーが出てしまいました。

依存関係のエラーはいいですが、コマンドが実行できなかったエラーは、cmakeのパッケージがYosemiteに対応していないだけだそうです。

#44210 (cmake fails to build for OS X 10.10 Yosemite) – MacPorts

以下を実行します。

$ sudo port clean cmake
$ sudo port upgrade outdated

portをインストールし直します。

$ port -qv installed > myports.txt
$ port echo requested | cut -d ' ' -f 1 > requested.txt
$ sudo port -f uninstall installed
$ sudo port clean all

$ curl -O https://svn.macports.org/repository/macports/contrib/restore_ports/restore_ports.tcl
$ chmod +x restore_ports.tcl
$ sudo ./restore_ports.tcl myports.txt

$ sudo port unsetrequested installed
$ < requested.txt xargs sudo port setrequested

再度アップグレードします。

$ sudo port sync
$ sudo port selfupdate

$ sudo port clean cmake
$ sudo port upgrade outdated

--->  Computing dependencies for py27-cython
--->  Fetching archive for py27-cython
--->  Attempting to fetch py27-cython-0.21.1_0.darwin_14.x86_64.tbz2 from http://jog.id.packages.macports.org/macports/packages/py27-cython
--->  Attempting to fetch py27-cython-0.21.1_0.darwin_14.x86_64.tbz2 from http://packages.macports.org/py27-cython
--->  Attempting to fetch py27-cython-0.21.1_0.darwin_14.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/py27-cython
--->  Fetching distfiles for py27-cython
--->  Attempting to fetch Cython-0.21.1.tar.gz from http://pypi.python.org/packages/source/C/Cython/
--->  Deactivating webp @0.4.1_0
--->  Cleaning webp
--->  Activating webp @0.4.2_0
--->  Cleaning webp
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  No broken files found.

エラーが出ず、アップグレードできました。

参考

MacPorts Guide

Migration – MacPorts

The MacPorts Project -- Download & Installation

追記

cmakeインストールしなければ、mysqlコマンド使えませんでした。

$ sudo port clean cmake
--->  Cleaning cmake

$ sudo port install cmake
--->  Computing dependencies for cmake
--->  Fetching archive for cmake
--->  Attempting to fetch cmake-3.0.2_0.darwin_14.x86_64.tbz2 from http://packages.macports.org/cmake
--->  Attempting to fetch cmake-3.0.2_0.darwin_14.x86_64.tbz2 from http://jog.id.packages.macports.org/macports/packages/cmake
--->  Attempting to fetch cmake-3.0.2_0.darwin_14.x86_64.tbz2 from http://lil.fr.packages.macports.org/cmake
--->  Fetching distfiles for cmake
--->  Verifying checksums for cmake
--->  Extracting cmake
--->  Applying patches to cmake
--->  Configuring cmake
Error: org.macports.configure for port cmake returned: configure failure: command execution failed
Please see the log file for port cmake for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port cmake failed

cmakeのインストールはパッケージに次いでmacportsのソースもインストールしなければなりません。

2.2. Install MacPorts

$ curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.3.1.tar.bz2
$ tar xf MacPorts-2.3.1.tar.bz2

$ cd MacPorts-2.3.1/
$ ./configure
$ make
$ sudo make install

Xcode

Xcode

その後、xcode 6.1をインストールします。

そして最後にcmakeをインストールします。

% sudo port install cmake
Password:
--->  Computing dependencies for cmake
--->  Configuring cmake
--->  Building cmake
--->  Staging cmake into destroot
--->  Installing cmake @3.0.2_0
--->  Activating cmake @3.0.2_0
--->  Cleaning cmake
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  No broken files found.

わーい、cmakeインストール完了です。

再度、MySQLを入れ直します。

$ sudo port install mysql55-server
--->  Computing dependencies for mysql55-server
--->  Dependencies to be installed: mysql55
--->  Fetching archive for mysql55
--->  Attempting to fetch mysql55-5.5.38_0.darwin_14.x86_64.tbz2 from http://packages.macports.org/mysql55
--->  Attempting to fetch mysql55-5.5.38_0.darwin_14.x86_64.tbz2 from http://jog.id.packages.macports.org/macports/packages/mysql55
--->  Attempting to fetch mysql55-5.5.38_0.darwin_14.x86_64.tbz2 from http://lil.fr.packages.macports.org/mysql55
--->  Fetching distfiles for mysql55
--->  Attempting to fetch mysql-5.5.38.tar.gz from http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.5
--->  Attempting to fetch mysql-5.5.38.tar.gz from http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.5
--->  Attempting to fetch mysql-5.5.38.tar.gz from http://cjj.kr.distfiles.macports.org/mysql55
--->  Verifying checksums for mysql55
--->  Extracting mysql55
--->  Applying patches to mysql55
--->  Configuring mysql55
--->  Building mysql55
--->  Staging mysql55 into destroot
--->  Installing mysql55 @5.5.38_0
The mysql55 client has been installed.
To install the mysql55 server, install the mysql55-server port.
--->  Activating mysql55 @5.5.38_0

On activation if no /opt/local/etc/mysql55/my.cnf file exists one
will be created which loads
/opt/local/etc/mysql55/macports-default.cnf.

If a /opt/local/etc/mysql55/my.cnf file exists MacPorts does not
touch it and any changes you make to /opt/local/etc/mysql55/my.cnf
will be preserved (e.g., during port upgrades, deactivations or
activations). /opt/local/etc/mysql55/my.cnf is a good place to
customize your mysql55 installation.

Any changes made to /opt/local/etc/mysql55/macports-default.cnf
will be lost during port upgrades, deactivations or activations so you
are advised to not make changes here. Currently
/opt/local/etc/mysql55/macports-default.cnf contains only one
directive; to disable networking. With disabled networking it is
possible to install and have running all the MacPorts mysql ports
simultaneously.

--->  Cleaning mysql55
--->  Fetching archive for mysql55-server
--->  Attempting to fetch mysql55-server-5.5.38_0.darwin_14.noarch.tbz2 from http://packages.macports.org/mysql55-server
--->  Attempting to fetch mysql55-server-5.5.38_0.darwin_14.noarch.tbz2 from http://jog.id.packages.macports.org/macports/packages/mysql55-server
--->  Attempting to fetch mysql55-server-5.5.38_0.darwin_14.noarch.tbz2 from http://lil.fr.packages.macports.org/mysql55-server
--->  Fetching distfiles for mysql55-server
--->  Verifying checksums for mysql55-server
--->  Extracting mysql55-server
--->  Configuring mysql55-server
--->  Building mysql55-server
--->  Staging mysql55-server into destroot
--->  Creating launchd control script
###########################################################
# A startup item has been generated that will aid in
# starting mysql55-server with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo port load mysql55-server
###########################################################
--->  Installing mysql55-server @5.5.38_0
--->  Activating mysql55-server @5.5.38_0

If this is a new install you might want to run:

$ sudo -u _mysql /opt/local/lib/mysql55/bin/mysql_install_db

--->  Cleaning mysql55-server
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  No broken files found.

$ diff /opt/local/etc/mysql55/my.cnf /opt/local/etc/mysql55/macports-default.cnf
1,2c1,3
< # Use default MacPorts settings
< !include /opt/local/etc/mysql55/macports-default.cnf
---
> # WARNING! ANY CHANGES TO THIS FILE WILL BE LOST ON UNINSTALL/UPGRADES!
> # Make your changes to /opt/local/etc/mysql55/my.cnf
> # YOU HAVE BEEN WARNED!
3a5
> # MacPorts default options
5,20c7,9
< max_allowed_packet = 16M
< character-set-server=utf8
<
< # Set minimum index length to 2 characters
< ft_min_word_len=2
<
< # Set utf8 as the default character set
< character-set-server=utf8
<
< [client]
< # Set utf8 as the default character set
< default-character-set=utf8
<
< [mysqldump]
< default-character-set=utf8
<
---
> # skip-networking so multple mysql server ports can be loaded
> # without each competing for port 3306.
> skip-networking

$ sudo port load mysql55-server
Password:
/opt/local/etc/LaunchDaemons/org.macports.mysql55-server/org.macports.mysql55-server.plist: Operation already in progress

$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.38 Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

やっと、mysqlコマンドが実行できるようになりました。

最後に再度、macportsの2.3.2へアップグレードします。

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

Not all sources could be fully synced using the old version of MacPorts.
Please run selfupdate again now that MacPorts base has been updated.

$ sudo port upgrade outdated
--->  Computing dependencies for libxml2
--->  Fetching archive for libxml2
--->  Attempting to fetch libxml2-2.9.2_0.darwin_14.x86_64.tbz2 from http://packages.macports.org/libxml2
--->  Cleaning libxml2
--->  Fetching archive for python_select
--->  Cleaning py27-libxml2
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  No broken files found.

無事、Yosemiteへの対応が終わりました。