标签归档:Mac OS X

Mac OS X 网络设置命令

设置route命令

在Mac OSX 中, 设置路由的命令稍有不同, 为:

route -n add defalut  10.13.31.1
route -n add   -net 10.0.0.0/8  10.13.31.1
route -n add -net 210.32.0.0/20   10.13.31.1
route -n add -net 222.205.0.0/17 10.13.31.1

提示路由存在时可以通过下面方法删除后再添加

route -n delete defalut  10.13.31.1

查看路由(route)

netstat –nr

设置DNS命令

得到所有接口(interfaces)

networksetup -listallnetworkservices

设置DNS(如果有多个DNS,那么用空格隔开)

networksetup -setdnsservers {INTERFACE NAME} {YOUR DNS SERVER} {YOUR DNS SERVER}

e.g:

sudo networksetup -setdnsservers AirPort 192.168.10.200

清空DNS缓存

dscacheutil –flushcache

Mac OS X 开启公测或开发版通道

20150122-mac-os-x

开启公测版通道:

sudo softwareupdate --set-catalog https://swscan.apple.com/content/catalogs/others/index-10.10beta-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz

开启开发版通道:

sudo softwareupdate --set-catalog https://swscan.apple.com/content/catalogs/others/index-10.10seed-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz

关闭方式:

sudo softwareupdate --clear-catalog

Homebrew

20150118 - brew

什么是Homebrew?

Mac OS X是基于Unix的操作系统,可以安装大部分为Unix/Linux开发的软件。然而,如果只是以使用为目的,对每个软件都进行手工编译不是很方便,也不利于管理已安装的软件,于是出现了类似于Linux中APT、Yum等类似的软件包管理系统,其中最著名的有MacPorts、Fink、Homebrew等。

继续阅读

Mac OS X 上用 Homebrew 安装 Nginx + PHP-FPM + MySQL + MsSQL + phpMyAdmin

Mac OS X 是一个非常不错的PHP开发环境,如果还在上面跑虚机做PHP,那么就太可惜了。
以前没用homebrew安装,一直磕磕碰碰,直到遇见它,一切变得如此的简单。对于我这些有洁癖的完美主义者来说,实在是一个福音。
(本文适用于Mac OS X 10.9 Mavericks 和 10.10 Yosemite)

1. Xcode

首先从app store下载,并安装xcode。

xcode-select --install

继续阅读

Fixing Bazaar for Mac OS X

When upgrading to Lion, if you try to run bzr, you’ll get an error:

$ bzr whoami
bzr: ERROR: Couldn't import bzrlib and dependencies.
Please check the directory containing bzrlib is on your PYTHONPATH.

Traceback (most recent call last):
  File "/usr/local/bin/bzr", line 102, in <module>
  import bzrlib
ImportError: No module named bzrlib

It seems to be caused by Lion’s switch to python 2.7 as default, while bazaar installs on python 2.6.

Edit the file /usr/local/bin/bzr (with sudo) and complete the first line:

#!/usr/bin/python

to

#!/usr/bin/python2.6

and save, that should do the trick.

$ bzr whoami
Name Surname <name@example.com>

CGO Compilation for Mac OS X 10.9 Mavericks

After upgrade to Mac OSX 10.9 you Cgo package will not be compiled successfully if you use the default clang compiler. For example, if you install gozmq on Mavericks you’ll get following error:

$ go get -tags zmq_3_x github.com/alecthomas/gozmq

clang: error: argument unused during compilation: '-fno-eliminate-unused-debug-types'

I tried apple-gcc4.2 installed from homebrew but also failed:

$ GCC=gcc-4.2 go get -tags zmq_3_x github.com/alecthomas/gozmq

clang: warning: argument unused during compilation: '-pthread'

clang: error: no such file or directory: 'libgcc.a'

The solution is to download and install pre-built gcc package GCC-10.7-v2.pkg from osx-gcc-installer. Then you can install the GO package as below:

$ GCC=gcc-4.2 go get -tags zmq_3_x github.com/alecthomas/gozmq

It works for other Cgo package like goejdb as well.

Good luck and have fun!

转自:http://vitecho.com/