Skip to main content

Posts

Showing posts with the label Mac

Emacs and MacOS Catalina

Catalina introduced a lot of security changes and the most intrusive is probably all the popups asking to give permission for apps to access directories under Home, like Documents. Worse still, apps which weren't written to handle the new security measures might just fail silently with no clues for the user. A solution is to give apps like Emacs "Full Disk Access" under "Security & Privacy" in Preferences, to give unfettered access to your files and avoid all the popups and silent failures. Sounds good, but that doesn't actually work for Emacs because "Emacs" in the app bundle is actually a Ruby script which decides which flavour of Emacs executable to run. This never mattered before, but it does under Catalina because MacOS thinks the executable is /usr/bin/ruby . Conventional wisdom is therefore to give "Full Disk Access" to Ruby. While this does work, I've always been uncomfortable giving all Ruby scripts full access...

Setting Environment Variables and the PATH on MacOS

Time Was setting environment variables and the PATH on a Mac running OSX was just like any other *IX.  However with successive OS releases Apple have changed how this works (more than once) and generally made it more difficult 😢  This article discusses how I go about setting environment variables on Mojave and Catalina. Why does this matter? MacOS doesn't add  /usr/local/bin to the PATH by default, which is unfortunate as most *IX-style programs you build yourself will be installed in there. If you only ever launch stuff from Terminal, all you have to do is set environment variables and the path from Shell startup files in the time immemorial fashion. However, this doesn't help with native Mac Apps like Emacs, which aren't launched from a shell and where you may still want to access custom environment variables and programs in /usr/local/bin . Setting the PATH In the past you could add to the path via /etc/paths (or paths.d ), however this no longer works...

The Strange Case of Emacs, # and the UK Keyboard

Programmers typing on the UK Mac keyboard have a problem with # # is commonly used in programming languages and the Mac UK layout puts # on ⌥ 3 (Alt-3), as opposed to Shift-3 on the US layout or Windows UK layout. This is a particular problem in Emacs, which interprets the ⌥ (Alt) key press as the Meta key and so Emacs receives M-3 instead of #. My first approach was just to make M-3 insert #: (define-key brf-mode-map "\M-3" (lambda () (interactive) (insert ?#))) This hoses bookmark 3 in brf-mode , but losing one bookmark seemed like a compromise I could live with. However it turns out this was a pretty dumb idea (😖), as it stops all the uses of # other than inserting, for example searching for # ! It also stops me typing the command for server-edit   ( C-x # ) , which is a very common usage for me. Looking around the web, people had some "creative solutions" for this problem: Inserting # handling into all the various keymaps This seems to be the m...

Enable Mac Startup Chime

As has been widely reported, it looks like Catalina has brought back the the ability to enable the classic Mac startup chime. Personally I like the boot chime 😀 To enable: $ sudo nvram StartupMute=%00 To revert back to default: $ sudo nvram StartupMute=%01 Note that if you reset the NVRAM, you'll have to apply this setting again.

Convert Parallels Disk to VirtualBox VDI

I used to use the free Parallels Desktop Lite on the Mac App Store to host various Linux virtual machines for software testing purposes. Although I'd heard things about the company's business practices, I thought it was a pretty fair deal allowing people to run free OS's for free - you only had to pay to run Windows. However about a year ago they introduced a mandatory subscription (at £74 per annum) even to run Linux, in the guise of a normal software update. None of this was mentioned in the update info - Nice 😡 No worries I thought (this is the polite version) - I'll just restore the previous version from Time Machine and Bob was indeed my uncle. This plan worked fine until I upgraded to Catalina and sure enough Parallels would no longer run. Rather than pay the Parallels ransom, I decided to investigate the alternatives. After some research I settled on VirtualBox, a free open-source VM from Oracle. VirtualBox was surprisingly easy (for an open-source pro...