Mac Networking
Change default sharing subnet
in case you want to share your connection (use your mac as a gateway/router) to let other computers share its WiFi connection, here’s what you do (change IP to subnet you want to use ):
First, read your existing config (as either root or sudo) like:
defaults read /Library/Preferences/SystemConfiguration/com.apple.nat |
you can set it like (change IP info to meet your needs)
defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberStart 192.168.10.0 |
Now disable/re-enable network sharing by doing Apple_button -> System Preferences -> Sharing -> (enable) Internet Sharing (and specify Ethernet interface), or you can restart networking for your interface by doing:
sudo ifconfig en0 down sudo ifconfig en0 up |
or just restarting your computer
reference in comments section at end.
Installing iftop / htop on Mac
iftop tells you all inbound and outbound connections to your Mac from the command line. Htop shows all running processes in cool hipster ways from the command line. You have to install Macports to use them, you can download/install it here for Mountain Lion. Then do:
su export PATH=/opt/local/bin:/usr/local/sbin/:/opt/local/sbin:$PATH port selfupdate <--if you want the latest packages port install iftop exit vi ~/.profile export PATH=/opt/local/bin:/usr/local/sbin/:/opt/local/sbin:$PATH <--add this line ln -s /usr/local/sbin/iftop /usr/sbin/iftop |
now look at your default interface en1 by doing:
sudo iftop -i en1 |
Mac install command line tools
If you want to work from the command line and have all your normal build environment, it’s a pain in the butt on Mac (compared to Linux/BSD=1 command), even though Mac is based on BSD. I have no idea why they do this, but hey, this is Mac.
1. Download XCode from app store. It’s friggin’ HUGE, like almost 2GB (just to get the tiny few Kb files you really need, yeeeeah). Oh, and you have to sign in with your account to get these free tools. Sheesh.
2. You’re still not there yet, because you have to tell Mac to actually USE them from the command line (seriously), so you do:
3. Launch XCode -> Preferences -> Downloads -> Components and click the little download arrow to the right of “Command Line Tools”. Once it downloads you have to then tell the command line to use them, so:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer ls /usr/bin/make |
if it worked, you should see ‘/usr/bin/make’ there now and be able to use it.
Write a comment
You need to login to post comments!