Skip to content

Mac OSX

introduction

I am no MAC fan, and this chapter will mostly be about the problems i encountered.

losing focus on xterm

I noticed this after a software update, xterm once selected shortly loses focus and turns back after a second or so. See klopt.org for detailed info, but it's my android phone attached as PTP camera. The program grabbing focus is com.apple.PTPCamera.

Set it to MTP !

I debugged this using this little program (watch_activations.py) :

watch_activations.py
#!/usr/bin/python
import signal
import sys
def signal_handler(signal, frame):
    sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGQUIT, signal_handler)

from AppKit import *

class MyObserver(NSObject):
    def appActivated_(self, notification):
         app = notification.userInfo()["NSWorkspaceApplicationKey"]
         NSLog(u"activated %@ (%@)", app.localizedName(), app.bundleIdentifier())

ws = NSWorkspace.sharedWorkspace()
nc = ws.notificationCenter()
ob = MyObserver.new()
nc.addObserver_selector_name_object_(ob, "appActivated:", NSWorkspaceDidActivateApplicationNotification, ws)  
NSRunLoop.currentRunLoop().run()
If you run this it will show which programs grabs the focus. Very handy. I could not disable PTPCamera with the guides mentioned on the interwebz, so mainly stick with what helps : disconnect your phone or set it to MTP (which is what you mostly want anyway)

yum/apt like manager

There is fink, and backports. But lately i have mostly use homebrew or 'brew' for short:

'''homebrew installs the stuff you need that Apple didn't '''

Install it with :

install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After that, for instance install wget with :

install
brew update
brew install wget

Mavericks on Virtualbox

In short : use niresh' mavericks : Here

One step back : ia description

Worked like a charm.

quick guide

Get the torrent file from niresh's site, you will need to endure some waiting and advertisements, but just put that in a background window and come back later.

It will unpack into a torrent file, which you than have to download, some more patience.

Please note that you need to comply with a number of issues mentioned in the description. They are :

  • Install the newest version of virtualbox, the default version from apt-get will NOT do. If you come here after installing, it's not too late, upgrade now and try to restart the VM.
  • Before installing disable the virtualbox option: "System->Enable EFI" this is on by default, it should be off.
  • Change the network card from Intel PRO/1000 T Server (82543GC) to Intel PRO/1000 MT Server (82545EM), and choose bridged network for ease.

apache

This seems to be installed from scratch, since i only had to

restart apache
sudo apachectl start

The interwebz assured me that this will automatically take care of start at reboot. In detail :

restart apache
It overrides the Disabled key in /System/Library/LaunchDaemons/org.apache.httpd.plist by modifying /private/var/db/launchd.db/com.apple.launchd/overrides.plist, just like launchctl load -w.

Some information i like to add here, though i yet have to try a restart to see if it works. Also i like to add this line to mock Apple for having a construct where one files says 'Disabled' and another one that negates this again, something only morons would do.

Also to aid in finding the web documents directory : the logical place is of course

web files
/Library/Webserver/Documents

And you can only edit that as root, or group member of wheel ... thanks Apple...

chrome

Problems accepting untrusted certificates on chrome ? Do it with safari, they end up in the keychain and chrome will use that as well.

network

auto config

To find out what the auto config is, you can download the .wad file that configures that. You can find the location in "Settings -> Network -> Advanced -> Proxies -> Proxy Configuration File" contained :

visit

This probably has not changed, download and view it, it is a plain text file. The proxy is easily found there.

tools

Automator

This is a way to create custom icons on your desktop. In fact it creates custom apps from commands, and thus you can have them on your desktop and in the sidebar. Run the automator and select "Application". You can then type a shell command to make it act like an application by selecting "Run shell script". You will get a standard command 'cat', which you can replace with

automator
/Users/keesklop/bin/x <yourhostname> &> /dev/null

This one will run the script that i use to startup an xterm with specific color for the given host. The last redirect is needed to run the command multiple times. For some reason it will only startup one if you do not redirect error output to /dev/null. Save the script you make as a new app. To have a custom icon for your app see next chapter.

Icons

To change icons for applications, this is the fastest way to get from an svg to a working icon. I use svg to be able to quickly change the color for an xterm picture, but this is not directly supported in osx, you should create a png from it. You can do this by opening the svg in the gimp, and then exporting it as png, all choices can remain default.

Now double click on the png file, it will get opened by preview, so just select "edit"->"copy". Now right click on the application and do "get info", select the icon at the left top, and paste (alt-v).

Even faster, i found out you can just copy the file when it's opened in the gimp. So open svg in gimp, edit->copy, then get info, and paste.

karabiner

The god-awful horrible keys of mac osx can be brought back to within reasonable damage (god i hate mac) by using karabiner. I almost have normal functioning keys now with these settings enabled :

under "Change FN key" : Fn to Control_L

under "Functional keys to F1..F12" : Speaker controls to F10,F11,F12

under "change key", "For pc Users" : Use PC style copy/paste Use PC style undo Use PC style find

Note: this will give problems on browsers doing shell simulation (all in-browser shells such as VNC, KVM and shellinabox) because the ctrl-c won't do a normal 'break'.

Since i use ctrl-c for copy a lot more, i choose this setting, when you need to do in browser shells : open up karabiner and disable the Use PC Style Copy/Paste option.( Leave it open to set it back when you are done)

troubleshooting

Losing focus

I noticed this after a software update, xterm once selected shortly loses focus and turns back after a second or so. See klopt.org for detailed info, but it's my android phone attached as PTP camera. The program grabbing focus is com.apple.PTPCamera.

Set it to MTP !

God i hate Apple.

opening text editor to copy/paste

Very annoying of the X server is that it cannot share it's copy-paste buffer with OSX. But if you open a file with the osx editor (TextEdit) it can copy paste.

Still you need a ridiculous round trip to open up TextEdit :

text editor
open -a TextEdit localfile

God i hate Apple.

repeatedly asking for keychain Access password

This was probably caused by not changing the password in the correct place. For instance changing it on the command line (you bastard....) So my first advise is :

change you password via "System preferences" -> "Users & groups" -> "Change password'

Still this is not your fault if you did "IT IS APPLE'S FAULT" so now how to fix it.. This is a sequence of steps i took to at least lessen the problems :

  • change you password again to another password via the System preferences"
  • Then back again so you now have done it the way apple wants.
  • Open "key chain access" and select "preferences" -> "First Aid"
  • i selected all options and closed again
  • now select "key chain access" -> "keychain first aid"
  • edit you password and hit verify
  • if it mentions something run 'repair' otherwise toggle keys in point 4 until it does detect a problem.
  • reboot a lot in between

Remember : this is what i DID, so i am not sure which steps are really needed or not. And my all time advise: scrap your mac and buy a real machine.

God i hate Apple...

Workstation

Here are some experiences while working with the iMac workstation at RINIS 2014-2017.

google drive

Do not use google drive for osx, since it stops working after a while and is a complete horror to remove again.

And after that, if you are stubborn here is how to install and remove it again.

installation

You can get your drive mounted on OSX with the google drive app. To get it working behind a proxy however is a different problem. The solution was here :

visit

He solved his own, and my problem. However what is not mentioned is that google drive stay running after the first failed connection attempt and you will have to kill it to retry:

kill google drive
1
2
3
ps aux | grep Drive : 
keesklop          807   0.1  1.8  2897456 152812   ??  S     4:28PM   0:01.15 /Applications/Google Drive.app/Contents/MacOS/Google Drive
kill -9 807

Manually you could now set the proxy and run from the command line :

proxy
export DRIVE_SYNC_FORCE_PROXY=http://10.10.1.13:3128
open -a Google Drive

It should work now, but it is not very convenient. So right click the icon in the top bar and hit the ellipses, you can choose preferences there. Then choose "Advanced" , "System settings" : untick "Start Google drive on system startup"

Then use either platypus or automator to bundle these two commands in a script, or how about just bash ?

remove google drive

Told you...

And lately, i come to the conclusion that it does not work !!, copying files to the drive just does not do anything, and it becomes useless. Especially on OSX !! Deleting is also much of a bother. You could look it up in Applications and trash it. Bit the icon remains even after you empty the trash. It turn out there is another Application directory under your home directory !! Delete it there and finally it is gone.

hanging appstore

Note God i hate apple...

First find the AppStore process id and kill the hanging bastard :

kill appstore
ps aux | grep Store 
kill -9 XXX

That' one problem out of the way, now we have to kill softwareupdated, but we need to be root for that:

kill more
1
2
3
su
ps aux | grep softwareupdated
kill -9 YYY

Next we have to delete the appstore cache, you can open up a finder window.

CTRL-SHIFT-r refresh

This is the normal key combination for chrome to do a page refresh and ignoring any cache on the server or client. A VITAL function in development. However osx wants to do it different and has another combination :

CMD-SHIFT-r , on my keyboard settings that becomes : WIN-SHIFT-r

Hit it a couple of times before you give up ..

See this page for more visit

volume osx

sound volume
sudo osascript -e "set volume 0.8" 

1.0 is about maximum

exim4 bind problem

First thing you notice is that mail does not work. Second thing you notice about this problem is that /var/log/exim4/main.log prints these lines

/var/log/exim4/main.log
1
2
3
4
5
6
2016-10-18 06:29:24 socket bind() to port 25 for address ::1 failed: Cannot assign requested address: waiting 30s before trying again (9 more tries)
2016-10-18 06:29:54 socket bind() to port 25 for address ::1 failed: Cannot assign requested address: waiting 30s before trying again (8 more tries)
2016-10-18 06:30:24 socket bind() to port 25 for address ::1 failed: Cannot assign requested address: waiting 30s before trying again (7 more tries)
2016-10-18 06:30:54 socket bind() to port 25 for address ::1 failed: Cannot assign requested address: waiting 30s before trying again (6 more tries)
2016-10-18 06:31:24 socket bind() to port 25 for address ::1 failed: Cannot assign requested address: waiting 30s before trying again (5 more tries)
2016-10-18 06:31:54 socket bind() to port 25 for address ::1 failed: Cannot assign requested address: waiting 30s before trying again (4 more tries)

Now note that it complains about a ipv6 localhost address : ::1 You can disable it in /etc/exim4/exim4.conf BUT a better solution on the interwebz said you should re-run :

reconfigure exim4
sudo dpkg-reconfigure exim4-config 

And wait until the listen option comes along. Just remove the ::1; part there. Maybe also remove the 192.168 .. address if you just want to use it as localhost.