Hope is a good thing.

タグ ‘Mac’ がついた投稿

MacPortsでLeopardにPostgreSQLをインストール

11/05/2008 · コメントを書く

会社でPostgreSQLを使う案件に携わることになったため、今まで敬遠していたPostgreSQLをインストール。

そのメモ。

インストール


$ sudo port install postgresql83-server
--->  Fetching ossp-uuid
--->  Attempting to fetch uuid-1.6.1.tar.gz from ftp://ftp.ossp.org/pkg/lib/uuid/
--->  Verifying checksum(s) for ossp-uuid
--->  Extracting ossp-uuid
--->  Applying patches to ossp-uuid
--->  Configuring ossp-uuid
--->  Building ossp-uuid with target all
--->  Staging ossp-uuid into destroot
--->  Packaging tgz archive for ossp-uuid 1.6.1_0
--->  Installing ossp-uuid 1.6.1_0
--->  Activating ossp-uuid 1.6.1_0
--->  Cleaning ossp-uuid
--->  Fetching postgresql83
--->  Attempting to fetch postgresql-8.3.4.tar.bz2 from http://ftp3.de.postgresql.org/pub/Mirrors/ftp.postgresql.org/source/v8.3.4/
--->  Verifying checksum(s) for postgresql83
--->  Extracting postgresql83
--->  Configuring postgresql83
--->  Building postgresql83
--->  Staging postgresql83 into destroot
--->  Packaging tgz archive for postgresql83 8.3.4_0
--->  Installing postgresql83 8.3.4_0

To use the postgresql server, install the postgresql83-server port
--->  Activating postgresql83 8.3.4_0
--->  Cleaning postgresql83
--->  Fetching postgresql83-server
--->  Verifying checksum(s) for postgresql83-server
--->  Extracting postgresql83-server
--->  Configuring postgresql83-server
--->  Building postgresql83-server with target all
--->  Staging postgresql83-server into destroot
--->  Creating launchd control script
###########################################################
# A startup item has been generated that will aid in
# starting postgresql83-server with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist
###########################################################
--->  Packaging tgz archive for postgresql83-server 8.3.4_0
--->  Installing postgresql83-server 8.3.4_0

To create a database instance, after install do
 sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb
 sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb
 sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb'

To tweak your DBMS, consider increasing kern.sysv.shmmax by adding an increased kern.sysv.shmmax .. to /etc/sysctl.conf
--->  Activating postgresql83-server 8.3.4_0
--->  Cleaning postgresql83-server

PostgreSQLの初期化

そのあとに上記で表示されたいくつかのコマンドを実行


$ sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb
$ sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb
$ sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb'
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale ja_JP.UTF-8.
The default database encoding has accordingly been set to UTF8.
initdb: could not find suitable text search configuration for locale ja_JP.UTF-8
The default text search configuration will be set to "simple".

fixing permissions on existing directory /opt/local/var/db/postgresql83/defaultdb ... ok
creating subdirectories ... ok
selecting default max_connections ... 20
selecting default shared_buffers/max_fsm_pages ... 2400kB/20000
creating configuration files ... ok
creating template1 database in /opt/local/var/db/postgresql83/defaultdb/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    /opt/local/lib/postgresql83/bin/postgres -D /opt/local/var/db/postgresql83/defaultdb
or
    /opt/local/lib/postgresql83/bin/pg_ctl -D /opt/local/var/db/postgresql83/defaultdb -l logfile start

デーモンの設定


$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist

カテゴリー: Mac · Programming
タグ: ,

TextMateにGit Textmate bundleをインストール

05/26/2008 · コメントを書く

TextMateのGit Textmate bundleをインストール。

Git Textmate bundleをgitでインストール


$ cd ~/Library/Application Support/TextMate/Bundles/
$ git clone git://gitorious.org/git-tmbundle/mainline.git Git.tmbundle

TextMateのbundleをリロード


$osascript -e 'tell app "TextMate" to reload bundles'

gitのコミットメッセージ用のエディターをTextMateに設定


$ emacs ~/.bashrc
export GIT_EDITOR="mate -w"

TextMateにTM_GIT変数を設定

TextMate-Preferences-Advanced-Shell Variablesを開いて
Variable : TM_GIT
Value : /opt/local/bin/git
を設定。
Valueについてはgitコマンドのあるところ。
自分の場合は、


$ which git
/opt/local/bin/git

カテゴリー: Mac · Programming
タグ: , ,

Mac OS Xにgitをインストール

05/25/2008 · コメントを書く

Macに今話題のgitをインストールする。

MacPortsにgitがあるか検索


$ 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.5.5.1      The stupid content tracker.
stgit                          devel/stgit    0.14.1       Push/pop utility on top of GIT
cgit                           www/cgit       0.7.1        A fast web interface for the git source code management system

git-coreをインストール


$ sudo port install git-core +svn +gitweb
--->  Fetching curl
--->  Attempting to fetch curl-7.18.1.tar.bz2 from http://curl.haxx.se/download/
--->  Verifying checksum(s) for curl
--->  Extracting curl
--->  Configuring curl
--->  Building curl with target all
--->  Staging curl into destroot
--->  Packaging tgz archive for curl 7.18.1_2
--->  Installing curl 7.18.1_2
--->  Activating curl 7.18.1_2
--->  Cleaning curl
--->  Fetching openssh
--->  Attempting to fetch DVG-5142987_launchd_DISPLAY_for_X11.patch from http://www.opensource.apple.com/darwinsource/10.5/OpenSSH-87/patches/
--->  Attempting to fetch openssh-5.0p1.tar.gz from http://mirror.roothell.org/pub/OpenBSD/OpenSSH/portable
--->  Verifying checksum(s) for openssh
--->  Extracting openssh
--->  Applying patches to openssh
--->  Configuring openssh
--->  Building openssh with target all
--->  Staging openssh into destroot
--->  Creating launchd control script
###########################################################
# A startup item has been generated that will aid in
# starting openssh with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo launchctl load -w /Library/LaunchDaemons/org.macports.OpenSSH.plist
###########################################################
--->  Packaging tgz archive for openssh 5.0p1_0+darwin_9
--->  Installing openssh 5.0p1_0+darwin_9
--->  Activating openssh 5.0p1_0+darwin_9
--->  Cleaning openssh
--->  Fetching p5-error
--->  Attempting to fetch Error-0.17012.tar.gz from http://ftp.ucr.ac.cr/Unix/CPAN/modules/by-module/Error
--->  Verifying checksum(s) for p5-error
--->  Extracting p5-error
--->  Configuring p5-error
--->  Building p5-error with target all
--->  Staging p5-error into destroot
--->  Packaging tgz archive for p5-error 0.17012_0
--->  Installing p5-error 0.17012_0
--->  Activating p5-error 0.17012_0
--->  Cleaning p5-error
--->  Fetching p5-compress-raw-zlib
--->  Attempting to fetch Compress-Raw-Zlib-2.011.tar.gz from http://ftp.ucr.ac.cr/Unix/CPAN/modules/by-module/Compress
--->  Verifying checksum(s) for p5-compress-raw-zlib
--->  Extracting p5-compress-raw-zlib
--->  Configuring p5-compress-raw-zlib
--->  Building p5-compress-raw-zlib with target all
--->  Staging p5-compress-raw-zlib into destroot
--->  Packaging tgz archive for p5-compress-raw-zlib 2.011_0
--->  Installing p5-compress-raw-zlib 2.011_0
--->  Activating p5-compress-raw-zlib 2.011_0
--->  Cleaning p5-compress-raw-zlib
--->  Fetching p5-io-compress-base
--->  Attempting to fetch IO-Compress-Base-2.011.tar.gz from http://ftp.ucr.ac.cr/Unix/CPAN/modules/by-module/IO
--->  Verifying checksum(s) for p5-io-compress-base
--->  Extracting p5-io-compress-base
--->  Configuring p5-io-compress-base
--->  Building p5-io-compress-base with target all
--->  Staging p5-io-compress-base into destroot
--->  Packaging tgz archive for p5-io-compress-base 2.011_0
--->  Installing p5-io-compress-base 2.011_0
--->  Activating p5-io-compress-base 2.011_0
--->  Cleaning p5-io-compress-base
--->  Fetching p5-io-compress-zlib
--->  Attempting to fetch IO-Compress-Zlib-2.011.tar.gz from http://ftp.ucr.ac.cr/Unix/CPAN/modules/by-module/IO
--->  Verifying checksum(s) for p5-io-compress-zlib
--->  Extracting p5-io-compress-zlib
--->  Configuring p5-io-compress-zlib
--->  Building p5-io-compress-zlib with target all
--->  Staging p5-io-compress-zlib into destroot
--->  Packaging tgz archive for p5-io-compress-zlib 2.011_0
--->  Installing p5-io-compress-zlib 2.011_0
--->  Activating p5-io-compress-zlib 2.011_0
--->  Cleaning p5-io-compress-zlib
--->  Fetching p5-compress-zlib
--->  Attempting to fetch Compress-Zlib-2.011.tar.gz from http://ftp.ucr.ac.cr/Unix/CPAN/modules/by-module/Compress
--->  Verifying checksum(s) for p5-compress-zlib
--->  Extracting p5-compress-zlib
--->  Configuring p5-compress-zlib
--->  Building p5-compress-zlib with target all
--->  Staging p5-compress-zlib into destroot
--->  Packaging tgz archive for p5-compress-zlib 2.011_0
--->  Installing p5-compress-zlib 2.011_0
--->  Activating p5-compress-zlib 2.011_0
--->  Cleaning p5-compress-zlib
--->  Fetching p5-html-tagset
--->  Attempting to fetch HTML-Tagset-3.20.tar.gz from http://ftp.ucr.ac.cr/Unix/CPAN/modules/by-module/HTML
--->  Verifying checksum(s) for p5-html-tagset
--->  Extracting p5-html-tagset
--->  Configuring p5-html-tagset
--->  Building p5-html-tagset with target all
--->  Staging p5-html-tagset into destroot
--->  Packaging tgz archive for p5-html-tagset 3.20_0
--->  Installing p5-html-tagset 3.20_0
--->  Activating p5-html-tagset 3.20_0
--->  Cleaning p5-html-tagset
--->  Fetching p5-html-parser
--->  Attempting to fetch HTML-Parser-3.56.tar.gz from http://ftp.ucr.ac.cr/Unix/CPAN/modules/by-module/HTML
--->  Verifying checksum(s) for p5-html-parser
--->  Extracting p5-html-parser
--->  Configuring p5-html-parser
--->  Building p5-html-parser with target all
--->  Staging p5-html-parser into destroot
--->  Packaging tgz archive for p5-html-parser 3.56_0
--->  Installing p5-html-parser 3.56_0
--->  Activating p5-html-parser 3.56_0
--->  Cleaning p5-html-parser
--->  Fetching p5-uri
--->  Attempting to fetch URI-1.35.tar.gz from http://ftp.ucr.ac.cr/Unix/CPAN/modules/by-module/URI
--->  Verifying checksum(s) for p5-uri
--->  Extracting p5-uri
--->  Configuring p5-uri
--->  Building p5-uri with target all
--->  Staging p5-uri into destroot
--->  Packaging tgz archive for p5-uri 1.35_1
--->  Installing p5-uri 1.35_1
--->  Activating p5-uri 1.35_1
--->  Cleaning p5-uri
--->  Fetching p5-libwww-perl
--->  Attempting to fetch libwww-perl-5.812.tar.gz from http://ftp.ucr.ac.cr/Unix/CPAN/modules/by-module/LWP
--->  Verifying checksum(s) for p5-libwww-perl
--->  Extracting p5-libwww-perl
--->  Configuring p5-libwww-perl
--->  Building p5-libwww-perl with target all
--->  Staging p5-libwww-perl into destroot
--->  Packaging tgz archive for p5-libwww-perl 5.812_0
--->  Installing p5-libwww-perl 5.812_0
--->  Activating p5-libwww-perl 5.812_0
--->  Cleaning p5-libwww-perl
--->  Fetching subversion-perlbindings
--->  Verifying checksum(s) for subversion-perlbindings
--->  Extracting subversion-perlbindings
--->  Configuring subversion-perlbindings
--->  Building subversion-perlbindings with target swig-pl
--->  Staging subversion-perlbindings into destroot
--->  Packaging tgz archive for subversion-perlbindings 1.4.6_0
--->  Installing subversion-perlbindings 1.4.6_0
--->  Activating subversion-perlbindings 1.4.6_0
--->  Cleaning subversion-perlbindings
--->  Fetching p5-svn-simple
--->  Attempting to fetch SVN-Simple-0.27.tar.gz from http://cpan.perl.org/authors/id/C/CL/CLKAO/
--->  Verifying checksum(s) for p5-svn-simple
--->  Extracting p5-svn-simple
--->  Configuring p5-svn-simple
--->  Building p5-svn-simple with target all
--->  Staging p5-svn-simple into destroot
--->  Packaging tgz archive for p5-svn-simple 0.27_0
--->  Installing p5-svn-simple 0.27_0
--->  Activating p5-svn-simple 0.27_0
--->  Cleaning p5-svn-simple
--->  Fetching p5-term-readkey
--->  Attempting to fetch TermReadKey-2.30.tar.gz from http://ftp.ucr.ac.cr/Unix/CPAN/modules/by-module/Term
--->  Verifying checksum(s) for p5-term-readkey
--->  Extracting p5-term-readkey
--->  Configuring p5-term-readkey
--->  Building p5-term-readkey with target all
--->  Staging p5-term-readkey into destroot
--->  Packaging tgz archive for p5-term-readkey 2.30_0
--->  Installing p5-term-readkey 2.30_0
--->  Activating p5-term-readkey 2.30_0
--->  Cleaning p5-term-readkey
--->  Fetching popt
--->  Attempting to fetch popt-1.13.tar.gz from http://rpm5.org/files/popt/
--->  Verifying checksum(s) for popt
--->  Extracting popt
--->  Configuring popt
--->  Building popt with target all
--->  Staging popt into destroot
--->  Packaging tgz archive for popt 1.13_0
--->  Installing popt 1.13_0
--->  Activating popt 1.13_0
--->  Cleaning popt
--->  Fetching rsync
--->  Attempting to fetch rsync-3.0.2.tar.gz from http://rsync.samba.org/ftp/rsync/
--->  Verifying checksum(s) for rsync
--->  Extracting rsync
--->  Configuring rsync
--->  Building rsync with target all
--->  Staging rsync into destroot
--->  Packaging tgz archive for rsync 3.0.2_0
--->  Installing rsync 3.0.2_0
--->  Activating rsync 3.0.2_0
--->  Cleaning rsync
--->  Fetching git-core
--->  Attempting to fetch git-1.5.5.1.tar.bz2 from http://www.kernel.org/pub/software/scm/git/
--->  Attempting to fetch git-manpages-1.5.5.1.tar.bz2 from http://www.kernel.org/pub/software/scm/git/
--->  Attempting to fetch git-htmldocs-1.5.5.1.tar.bz2 from http://www.kernel.org/pub/software/scm/git/
--->  Verifying checksum(s) for git-core
--->  Extracting git-core
--->  Applying patches to git-core
--->  Configuring git-core
--->  Building git-core with target all gitweb/gitweb.cgi
--->  Staging git-core into destroot
--->  Packaging tgz archive for git-core 1.5.5.1_0+doc+gitweb+svn
--->  Installing git-core 1.5.5.1_0+doc+gitweb+svn
--->  Activating git-core 1.5.5.1_0+doc+gitweb+svn
--->  Cleaning git-core

cogitoをインストール


$ sudo port install cogito
--->  Fetching coreutils
--->  Attempting to fetch coreutils-6.11.tar.gz from http://ftp.gnu.org/gnu/coreutils
--->  Verifying checksum(s) for coreutils
--->  Extracting coreutils
--->  Configuring coreutils
--->  Building coreutils with target all
--->  Staging coreutils into destroot
--->  Packaging tgz archive for coreutils 6.11_0+darwin_9
--->  Installing coreutils 6.11_0+darwin_9
--->  Activating coreutils 6.11_0+darwin_9
--->  Cleaning coreutils
--->  Fetching cogito
--->  Attempting to fetch cogito-0.18.2.tar.bz2 from http://kernel.org/pub/software/scm/cogito/
--->  Verifying checksum(s) for cogito
--->  Extracting cogito
--->  Applying patches to cogito
--->  Configuring cogito
--->  Building cogito with target all
--->  Staging cogito into destroot
Error: Target org.macports.destroot returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_cogito/work/cogito-0.18.2" && gnumake install prefix=/opt/local DESTDIR=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_cogito/work/destroot " returned error 2
Command output: m755 -d /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_cogito/work/destroot/opt/local/bin
gnumake: m755: Command not found
gnumake: [install-cogito] Error 127 (ignored)
cg-object-id cg-add cg-admin-lsobj cg-admin-uncommit cg-branch-add cg-branch-ls cg-reset cg-clone cg-commit cg-diff cg-export cg-help cg-init cg-log cg-merge cg-mkpatch cg-patch cg-fetch cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls cg-update cg cg-admin-ls cg-push cg-branch-chg cg-admin-cat cg-clean cg-admin-setuprepo cg-switch cg-mv cg-admin-rewritehist cg-tag-show cg-version /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_cogito/work/destroot/opt/local/bin
gnumake: cg-object-id: Command not found
gnumake: *** [install-cogito] Error 127

Error: Status 1 encountered during processing.

なんかエラーが発生した。
ググったら例えばerror installing cogitoというページを発見。
どうももう一回コマンド叩けばうまくいくかもって書いてあるので再度実行。


$ sudo port install cogito
--->  Staging cogito into destroot
--->  Packaging tgz archive for cogito 0.18.2_1
--->  Installing cogito 0.18.2_1
--->  Activating cogito 0.18.2_1
--->  Cleaning cogito

うまくいった。

カテゴリー: Mac · Programming
タグ: ,