Archive for the ‘Mac OS X 10.6 Snow Leopard’ Category
Posted by jpluimers on 2017/02/08
On most systems, I use bash as shell, but not all systems have it, for instance the shell.xs4all.nl server uses tcsh and ESXi 4+ uses a very limited ash shell from busybox (ESX 4 had bash though).
There is this huge script that covers many shell and operating system versions (even DOS, Windows) and interpreters (python, ruby, php, etc) what shell is this which I got through Stéphane Chazelas‘s answer in linux – determine shell in script during runtime – Unix & Linux Stack Exchange
I wanted a shorter thing that works in current Linux, BSD, OS X and ESXi versions.
Some very short scripts are less reliable, for instance echo $SHELL looks nice, but isn’t always set.
Similar for echo $0 which will fail for instance if it shows as sh but in fact is a different shell in disguise.
This works for bash, tcsh and busybox sh, is a bit more precise than getting $0. It’s based on HOWTO: Detect bash from shell script – Stack Overflow:
lsof -p $$ | awk '(NR==2) {print $1}'
But on ESXi it shows this because lsof doesn’t take any parameter there and just dumps all information:
----------+---------------------+---------------------+--------+------------------
It’s because lsof on ESXi always shows this header where Cartel and World aren’t exactly well documented:
Cartel | World name | Type | fd | Description
----------+---------------------+---------------------+--------+------------------
Empirically for non VM related processes, it looks like the Cartel is the PID and World name the command.
On Linux and BSD based systems, the header looks like this, so command and PID are reversed in ESXi:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
This command then works on both ESXi, OS X, Linux and BSD assuming you can word search for the PID and noting that PID/command will be reversed on ESXi as compared to OSX/Linux/BSD:
lsof -p $$ | grep -w $$ | awk '(NR==2) {print $1,$2}'
–jeroen
Posted in Apple, bash, BSD, Development, iMac, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.11 El Capitan, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2017/01/26
I had this occurring on my system:
RetinaMBPro1TB:~ jeroenp$ brew update
error: unable to unlink old 'Library/ENV/pkgconfig/10.11/libcurl.pc' (Permission denied)
error: unable to unlink old 'Library/ENV/pkgconfig/10.11/libxml-2.0.pc' (Permission denied)
error: unable to unlink old 'Library/ENV/pkgconfig/10.11/sqlite3.pc' (Permission denied)
To restore the stashed changes to /usr/local run:
'cd /usr/local && git stash pop'
Already up-to-date.
This is how I solved it:
RetinaMBPro1TB:~ jeroenp$ ls -al /usr/local | grep -w Library
drwxr-xr-x+ 11 jeroenp admin 374 Mar 9 19:33 Library
RetinaMBPro1TB:~ jeroenp$ sudo chown -R $USER /usr/local/Library/
Password:
RetinaMBPro1TB:~ jeroenp$ brew update
To restore the stashed changes to /usr/local run:
'cd /usr/local && git stash pop'
Updated Homebrew from d32996d to 638d755.
==> New Formulae
...
==> Updated Formulae
...
==> Renamed Formulae
...
==> Deleted Formulae
...
RetinaMBPro1TB:~ jeroenp$
The above solution is based on major python problems · Issue #48301 · Homebrew/homebrew
After that, I could install plantuml (which requires java, just so you know) so now I can create SVGs from it locally:
plantuml -tsvg PSO.network-diagram.PlantUML.txt
Note I had to edit the formula so it installs plantuml-8037 or higher (the git version back then installed plantuml-8031) as it fixed a namespace bug. Since plantuml releases often, be prepared to do some version fiddling.
–jeroen
Posted in *nix, *nix-tools, Apple, Development, Diagram, Home brew / homebrew, Java, Java Platform, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, PlantUML, Power User, Software Development, UML | Leave a Comment »
Posted by jpluimers on 2017/01/10
Getting the local IP (actually IPs, but most hosts only have a single IP):
# OS X:
alias whatismylocalip='ifconfig | sed -En '\''s/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'\'''
# Linux:
alias whatismylocalip='ip a | sed -En '\''s/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'\'''
I got them via bash – How to I get the primary IP address of the local machine on Linux and OS X? – Stack Overflow
Mac OS X and BSD have ifconfig, but most Linux distributions don’t use ifconfig any more in favour of iproute2, so you use ip a (which is shorthand for ip address show) there.
Their output is similar enough for the sed to work, though. Which surprised be because I didn’t know about the -E option (it lacks in the manual Linux page but it is in the Mac OS X one) which enables POSIX extended regular expressions. In Linux this is documented as -r, but -E also works.
I learned this through the Sed – An Introduction and Tutorial which compares the various versions of sed which also explains about the -n doing no printing.
–jeroen
Posted in *nix, *nix-tools, Apple, bash, bash, Development, Linux, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, openSuSE, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development, SuSE Linux, Tumbleweed | Leave a Comment »
Posted by jpluimers on 2016/12/23
Interesting: diskutil secureErase freespace LEVEL /Volumes/DRIVENAME
–jeroen
Source: How to securely delete files in OS X 10.11 ‘El Capitan’ | MacIssues
Posted in Apple, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User | Leave a Comment »
Posted by jpluimers on 2016/10/07
The most recent versions of Joe don’t even build from stock in OS X any more and there are no direct installers for them.
But there are two most recent older versions that have installers, and a formula recent brew based HomeBrew installation:
- joe-3.7-0.pkg – rudix-snowleopard – JOE – Rudix: The hassle-free way to get Unix programs on Mac OS X – Google Project Hosting.
- PROJECT DETAIL for Joe’s Own Editor.
- Homebrew Formulas – Joe.
After experimenting for a while without brew preferring the first over second, I’ve installed the the third as:
- The first actually installs version 3.6, but has the syntax highlighting files installed in the correct place, so you get syntax highlighting.
- The second does install version 3.7, but since the syntax highlighting files are in the wrong place: you get no syntax highlighting.
- The brew formula has an up to date joe version 4.0 and installs the syntax highlighting in the right place: you get syntax highlighting.
Before making a choice, you might want to consider reading about joe versions in JOE – Joe’s own editor / … /NEWS.md.
Having a background partially in the Linux world, I tried building joe from source on my Mac following the steps at JOE – Joe’s own editor / Discussion / joe-editor-general:Mac binary for 3.3 does not run on OS/X 10.8. It failed because the Mercurial 3.8 branch required automake and autoconf which are not available on just a Mac + Xcode. So I’m happy that others have bit the bullet and make a good HomeBrew build.
What makes HomeBrew so great is that it is based on a fully versioned git/ruby combination, allows for multiple Python versions, allows for binaries through bintray served bottles and has zillions (well, thousands) of installable formulae, all versioned.
–jeroen
Posted in *nix, *nix-tools, Apple, joe, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User | Leave a Comment »
Posted by jpluimers on 2016/08/17
A while ago, testssl.sh [WayBack] needed Darwin binaries (for OS X): Supply Darwin binaries + install documentation · Issue #127 · drwetter/testssl.sh [WayBack]
So I created the small Bourne shell (sh) script below to deliver them.
It allows me to update these gists:
The build script itself is in a gist as well: https://gist.github.com/f4de3937630b87753133.git [WayBack]
It helped me to contribute to these testssl.sh issues:
Not all of these binaries are in https://github.com/drwetter/testssl.sh/tree/master/bin [WayBack] as it makes the testssl.sh repository too bloated. Some (including non-OSX builds made by others) are here:
Eventually the script might get merged into https://github.com/drwetter/testssl.sh/blob/master/utils/make-openssl.sh [WayBack] as there is a Darwin switch in this commit: https://github.com/drwetter/testssl.sh/commit/6efc3e90f52e5926b0853d3b2fb221b631dcf452 [WayBack]
Read the rest of this entry »
Posted in Apple, Development, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OpenSSL, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Security, Software Development, xCode/Mac/iPad/iPhone/iOS/cocoa | Leave a Comment »
Posted by jpluimers on 2016/08/15
The culprit is usually the mds [WayBack] process (metadata server).
Simple command-line solution:
sudo killall mds
A more convoluted way with the Activity Monitor is in the link below.
–jeroen
via: Fix the OS X Finder not displaying the contents of specific folders | MacIssues [WayBack]
Posted in Apple, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.6 Snow Leopard, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, Power User | Leave a Comment »
Posted by jpluimers on 2016/06/07
Via the answer below I created the renew alias. I already had the first two aliases.
alias route-and-ipaddresses="netstat -nr | grep 'Internet\|Gateway\|default' && echo && ifconfig | grep '\: flags\|inet\|inet6' && echo more detailed info through ifconfig and netstat -nr"
alias whatismyip="curl http://whatismyip.akamai.com && echo"
alias renew_dhcp="sudo ipconfig set en0 DHCP && echo waiting 10 seconds for DHCP lease to be obtained && sleep 10 && route-and-ipaddresses && whatismyip"
–jeroen
via: network – How can I release and renew my DHCP lease from Terminal? – Ask Different.
Posted in Apple, bash, Development, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.6 Snow Leopard, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2016/05/26
Thanks Adrian W for providing the below example in your answer about obtaining GLUE record information for a domain.
It is an excellent showcase for the $IFS Internal Field Separator available in any nx shell.
In this case it is used to get the TLD (top-level domain) from the domain name specified at the command-line.
After that, it obtains the name servers for that TLD, and queries the glue records there, both using dig.
Here is a little shell script which implements Alnitak’s answer:
#!/bin/sh
S=${IFS}
IFS=.
for P in $1; do
TLD=${P}
done
IFS=${S}
echo "TLD: ${TLD}"
DNSLIST=$(dig +short ${TLD}. NS)
for DNS in ${DNSLIST}; do
echo "Checking ${DNS}"
dig +norec +nocomments +noquestion +nostats +nocmd @${DNS} $1 NS
done
Pass the name of the domain as parameter:
./checkgluerecords.sh example.org
–jeroen
via domain name system – How to test DNS glue record? – Server Fault.
Posted in *nix, Apple, bash, Development, DNS, Linux, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, openSuSE, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development, SuSE Linux | Leave a Comment »
Posted by jpluimers on 2016/03/18
Nice summary for just saying “Use Tunnelblick”
This howto article explains how to obtain and setup a Mac openvpn client to connect to the OpenVPN Access Server.
Source: How to connect to Access Server from a Mac
–jeroen
Posted in Apple, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OpenVPN, OS X 10.11 El Capitan, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User | Leave a Comment »