タグ : mac

[Mac] 特定のportを使用しているプロセスを確認するコマンド lsof -i

Mac で、特定のポートを使用しているプロセスを確認するコマンド lsof -i の使い方をメモ。

例えば、mongod が利用している port を確認したい場合は、

% lsof -i | grep mongod
mongod      365 your_username    9u  IPv4 0xd006e2ded5999795      0t0  TCP localhost:28017 (LISTEN)
mongod      365 your_username   10u  IPv4 0xd006e2deda2a3f7d      0t0  TCP localhost:27017 (LISTEN)

のような感じで 28017 番を利用していることが分かる。


参考情報

lsof – Wikipedia

開いているファイルのプロセスを特定(lsofコマンド) – Qiita

@IT:特定のポートをオープンしているプロセスを調べるには

[Mac] Wi-Fi(無線LAN)に繋がらないときの解決方法

Mac で、Wi-Fi(無線LAN)に繋がらないときに解決するのに参考になった記事をメモ。

MacのWi-Fiが無線LAN接続できない時の対処法12個まとめ | Macとかの雑記帳

ここを一通り確認すれば、解決しました。

[MacOS] システム環境設定の設定メモ [2013年版]

Mac の「システム環境設定」の個人用設定メモをご紹介します。

system-config

続きを読む

[Mac] nkf を Homebrew でインストール

Mac に Homebrew で nkf をインストールしました。

% brew install nkf                     
==> Downloading http://dl.sourceforge.jp/nkf/53171/nkf-2.1.2.tar.gz
######################################################################## 100.0%
==> Patching
patching file Makefile
==> make
==> make install
/usr/local/Cellar/nkf/2.1.2: 4 files, 252K, built in 2 seconds

楽ちん

[Mac] Redis を Homebrew でインストールする

Mac に Redis を Homebrew でインストールする手順をメモ。(最終更新日: 2017/03/31)

Redis のインストール

まず redis を homebrew でインストールします。

% brew install redis
==> Downloading http://redis.googlecode.com/files/redis-2.6.14.tar.gz
######################################################################## 100.0%
==> make -C /private/tmp/redis-ghPL/redis-2.6.14/src CC=cc
==> Caveats
To have launchd start redis at login:
    ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
Then to load redis now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
Or, if you don't want/need launchctl, you can just run:
    redis-server /usr/local/etc/redis.conf
==> Summary
 /usr/local/Cellar/redis/2.6.14: 10 files, 1.3M, built in 8 seconds

Redis 自動起動の設定

PC起動時に、redis を自動起動させたいなら、下記のコマンドを実行します。

ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

自動起動の設定はせずに、手動で redis を起動させるには下記のコマンドで起動できます。

redis-server /usr/local/etc/redis.conf

Redis へ CLI から接続確認

ターミナルから以下の command で Redis へ接続できるか確認します。

% redis-cli
redis 127.0.0.1:6379>

以上です。

参考情報

[PHP] Mac に PEAR、PHPUnit をインストールする

Mac OS X Mountain Lion に PEAR と PHPUnit をインストールする方法をメモ。

大枠は下記サイトを参考にしました。ありがとうございます。

PEAR のインストール

$ cd /tmp && mkdir pear && cd pear
$ curl -O http://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar
 1. Installation base ($prefix)                   : /usr/lib/php
 2. Temporary directory for processing            : /tmp/pear/install
 3. Temporary directory for downloads             : /tmp/pear/install
 4. Binaries directory                            : /usr/bin
 5. PHP code directory ($php_dir)                 : /usr/lib/php
 6. Documentation directory                       : /usr/lib/php/doc
 7. Data directory                                : /usr/lib/php/data
 8. User-modifiable configuration files directory : /usr/lib/php/cfg
 9. Public Web Files directory                    : /usr/lib/php/htdocs
10. Tests directory                               : /usr/lib/php/tests
11. Name of configuration file                    : /Users/your_username/.pearrc

php.ini に PEAR を include する設定を追加する

% sudo cp /etc/php.ini.default /etc/php.ini
% sudo chmod +w /etc/php.ini
% sudo vim /etc/php.ini
;include_path = ".:/php/includes"

↓(変更する)

include_path = ".:/php/includes:/usr/lib/php/share/pear"

Manual :: PEAR パッケージマネージャの取得とインストール

Mac OS X LionでPEARをインストールする方法 | Web活メモ帳

PHPUnit のインストール

% sudo pear channel-discover pear.phpunit.de
% sudo pear channel-discover components.ez.no
% sudo pear channel-discover pear.symfony-project.com
% sudo pear install phpunit/PHPUnit
 
% phpunit --version    
PHPUnit 3.7.1 by Sebastian Bergmann.

以上です。

[Mac] .DS_Store ファイルを作成しない設定方法

Mac から Windows の共有ディスクにアクセスすると .DS_Store というファイルが各ディレクトリに作られてしまいます。

.DS_Store を作成しない設定方法は、Terminal にて下記のコマンドを実行後、再起動するだけでOKです。

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

以上です。

参考情報

[Mac] wget のインストール方法

Mac に wget をインストールしました。

wget も Homebrew でサクッとインストールします。

brew install wget

まだ、Homebrew をインストールしていない方は、今すぐインストールしましょう!

[Mac] Homebrew をインストール

以上です。

[Mac] Xcode 4.2 から 4.1 へダウングレード(downgrade)する方法

Xcode 4.2 から 4.1 へダウングレードしました。

rvm を使って Ruby 1.9.2 をインストールして、いざ rvm requirements してみると、

“Xcode 4.2.1+ users – please be warned – ”

と出て、無理みたいだったので、Xcode 4.2 から Xcode 4.1 にダウングレードしました。
 

Xcode 4.2 から 4.1 にダウングレードする手順

1. Xcode 4.1のインストーラをダウンロードする

xcode_4.1_for_lion.dmg を Resources for Apple Developer からダウンロードします。

Resources for Apple Developers – Apple Developer

ダウンロードするにはDeveloper登録が必要です、(有料)
 

2. Xcode 4.2 をアンインストールする

下記のコマンドを実行します。

$ sudo /Developer/Library/uninstall-devtools --mode=all

3. アプリケーションフォルダ以下の Install Xcode.app を削除

xcode_4.1_for_lion.dmg で、アプリケーションフォルダに Install Xcode.app を作成するために、今あるインストーラー Install Xcode.app を削除します。
 

4. Xcode 4.1 をインストール

xcode_4.1_for_lion.dmg をマウントして、InstallXcodeLion.pkg をダブルクリックして、インストールします。
 

以上です。


参考情報

Xcode4.2から4.1へのダウングレードについて – 実はhokkai7go

How to remove XCode 4.2 and install 4.1 to develop Ruby / Rails on OSX Lion? – Stack Overflow

[Mac] Node.js と npm をインストールする方法 [Homebrew]

Macに Node.js と npm をインストールする方法を調べたのでメモ。

node.js を homebrew でインストールする

$ brew install node

正常にインストールされたことを確認します。

$ node -v
v0.4.11

 

npm を homebrew でインストールできない…

Homebrew の npm formula は、収録のポリシーに沿わない( https://github.com/mxcl/homebrew/wiki/Acceptable-Formula )として最近、取り除かれたそうです。

メッセージにあるように curl http://npmjs.org/install.sh | sh でインストールすべきみたいです。

$ brew install npm
Error: No available formula for npm
npm can be installed thusly by following the instructions at
  http://npmjs.org/
 
To do it in one line, use this command:
  curl http://npmjs.org/install.sh | sh

 

npm を curl経由でインストールする

$ curl http://npmjs.org/install.sh | sh

正常にインストールされたことを確認します。

$ npm -v
1.0.103

以上です。


参考情報

node.jsとnpmのインストール – 自分の感受性くらい

MacOSXでnode.js/npm/nvmをインストール – tagomorisのメモ置き場