Archive for the ‘Mac’ Category
Posted by jpluimers on 2017/03/30
Some links that helped me getting FTDI USB serial communication to Raspberry Pi systems going:
–jeroen
Posted in Apple, Communications Development, Development, Hardware Development, Hardware Interfacing, iMac, Legacy Ports: COM, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.9 Mavericks, Power User, Raspberry Pi, USB | Leave a Comment »
Posted by jpluimers on 2017/03/29
Every now and then, Google Drive on Mac OS X gets confused and starts showing the spinning wheel when hovering over the menu bar icon similar to for instance DropBox does every once in a while.
This is how to terminate and restart Google Drive from the terminal (no need for su):
killall -v -SIGKILL Google\ Drive
open -a Google\ Drive
Alternatively you can start Google Drive using this:
/Applications/Google\ Drive.app/Contents/MacOS/Google\ Drive &
I found this executable through osx – Find all executable files within a folder in terminal – Ask Different
Note that this won’t kill Google Drive as it sends the TERM signal (SIGTERM):
killall -v Google\ Drive
–jeroen
Posted in Apple, bash, Development, Google, GoogleDrive, iMac, Mac, Mac OS X / OS X / MacOS, 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 | 1 Comment »
Posted by jpluimers on 2017/03/20
Explains how to find out top 10 files and directories under Unix / Linux using sort and du command in human-readable format.
Interesting, especially
alias 'ducks=du -cks * | sort -rn | head'
Source: How Do I Find The Largest Top 10 Files and Directories On a Linux / UNIX / BSD?
via: Joe C. Hecht and nixCraft.
–jeroen
Posted in *nix, *nix-tools, Apple, BSD, Linux, Mac, Mac OS X / OS X / MacOS, Power User | Leave a Comment »
Posted by jpluimers on 2017/02/27
iMovie on a 2010 iMac was starting and running slow. During startup, it wasn’t using much memory, but during editing it did: less than 2 gigabyte out of 8 gigabyte free memory left.
The hard-disk was like 30% full, there wasn’t much in the cache, few processes were auto-starting and the recycle bin was almost empty.
So my first thought was adding more RAM (which is easy): duplicating it to 16 megabyte was easy and not expensive when you look at the Amazon prices for it.
After that it was faster, but not really fast: especially the loading was still slow (less slow than before, but still taking minutes).
Then I scanned for permission issues and there were quite a few as the machine had been getting updates since 2010. So I repaired the permissions using disk utility.
Now iMovie loaded much faster as well: in under a minute.
So out of 17 Ways to Speed Up Mac OS X Lion – ChrisWrites.com, only 2 steps were really needed so far.
–jeroen
Posted in Apple, iMac, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, OS X 10.10 Yosemite, OS X 10.11 El Capitan, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User | Leave a Comment »
Posted by jpluimers on 2017/02/20
Source: Finder doesn’t work since Yosemite – Ask Different [WayBack]:
This fix from Reddit worked perfectly for me!!
http://www.reddit.com/r/osx/comments/2jtikj/finder_not_responding_new_yosemite_install/ [WayBack]
You can most likely fix the issue by clearing out Finder’s saved state, caches, and/or settings.
Use Spotlight (the search icon in the far right of the menu bar) to find and open the “Terminal” application. Triple-click the following line in order to copy and paste it into Terminal’s window:
rm -fR ~/Library/Saved\ Application\ State/com.apple.finder.savedState ~/Library/Caches/com.apple.finder; killall Finder
If it still doesn’t work, try this one:
mv ~/Library/Preferences/com.apple.finder{,.backup}.plist; killall Finder
–jeroen
Read the rest of this entry »
Posted in Apple, iMac, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, Power User | Leave a Comment »
Posted by jpluimers on 2017/02/10
These links:
Made me add this to my ~/.bash_profile:
Read the rest of this entry »
Posted in Apple, 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.9 Mavericks, Power User | Leave a Comment »
Posted by jpluimers on 2017/02/09
Brilliant Date format converter from dates in Text (almost any format) or timestamp numbers in Unix, Mac, Filetime or Microsoft (which is the same as Delphi TDateTime) format to any of these formats:
Text Date:
Date in human-readable text |
Wednesday, March 23, 2016 4:05:39pm |
RFC 822:
RFC 822 formatted date |
Wed, 23 Mar 2016 16:05:39 +0000 |
ISO 8601:
ISO 8601 formatted date |
2016-03-23T16:05:39+00:00 |
UNIX Timestamp:
seconds since Jan 1 1970 |
1458749139 |
Mac Timestamp:
seconds since Jan 1 1904 |
3541593939 |
Microsoft Timestamp:
days since Dec 31 1899 |
42452.670590278 |
FILETIME:
100-nanoseconds since Jan 1 1601 |
131032227390000000
01D1851D:D7B58B80 |
Source: Date format converter
–jeroen
Posted in *nix, .NET, Apple, Delphi, Development, Mac, Mac OS X / OS X / MacOS, Power User, Software Development | 1 Comment »
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 »