Skip to main content

Senior Web Engineer. Open web / music. Remote DJ. Tall Dutch guy. #3million

micro.blog/sander

svandragt

mixcloud.com/cloudseer

 

Firefox's spelling checker wasn't working for me, and unfortunately it doesn't support the macOS default one, so I was seeing a lot of spelling errors. I fixed it by installing the recommended links at https://addons.mozilla.org/en-GB/firefox/language-tools/

 

Installing PyInstaller on a Poetry project on MacOS

I'm looking to create a cross-platform executable of my commandline application. The application is using poetry as the package manager, and I'm running this on MacOS.

First we need to install PyInstaller:

$ poetry add pyinstaller --dev

Then it should be as simple as running the following:

$ poetry shell
$ pyinstaller --onefile app/app.py

Macho Libre

However, this resulted in the following error:

ModuleNotFoundError: No module named 'macholib'

macholib can be used to analyze and edit Mach-O headers, the executable format used by Mac OS X.

It’s typically used as a dependency analysis tool, and also to rewrite dylib references in Mach-O headers to be @executable_path relative.

Manually adding this dependency to the project addresses this:

$ poetry add macholib --dev

NLTK

However, now calling pyinstaller again throws up a new error:

Unable to find "nltk_data" when adding binary and data files.

NLTK is a leading platform for building Python programs to work with human language data. It provides easy-to-use interfaces to over 50 corpora and lexical resources such as WordNet, along with a suite of text processing libraries for classification, tokenization, stemming, tagging, parsing, and semantic reasoning, wrappers for industrial-strength NLP libraries [...].

Fortunately we can download the missing data as follows (from within the poetry shell):

$ python
>>> import nltk
>>> nltk.download()

Press the download button on the window that pops up and make sure the installation path matches the error message path.

Then fix the path to NLTK in PyInstaller according to this StackOverflow answer. To get to the right location, ask poetry:

$ poetry env list --full-path
$ cd <path>/lib/python3.7/site-packages/PyInstaller/hooks

Rerunning the pyinstaller command after this produced an executable! However it's 1.2GB, propably due to including the macholib library.

I will update this post when I've figured this out.

 

I’m looking for a macOS tool that intercepts opening URLs and let me specificy regexes and associate them with browsers, so that when I open certain links from slack they always go into my project browser. Any ideas?

 

Staying focused

If you follow this blog you will have noticed that I've commented multiple times on needless distractions that seem to have pervaded modern computing. Today, let's present a few solutions.

Firstly, when in the flow of doing deep work, watching animations delay your actions can be a source of frustration. While we can't speed up GitHub, we can speed up macOS. In the accessibility settings, check Display > Reduce Motion. This will speed up the interface and Mission Control animations. If you miss the garishness, you can turn it back off but chances are you will notice the system not getting in the way as much.

Secondly a tip for fellow Homebrew users. When you're ready to work through that difficult project tooling setup, it can be the worst time for Homebrew to decide to update it self, especially as this can take up to half a minute depending on how far behind your version is. Not now Homebrew! If you follow the instructions at Homebrew Autoupdate you can setup Homebrew to update itself in the background.

Finally, if you're using oh-my-zsh or bash equivalent, there will be a setting for it to update itself without prompting. Edit .zshrc and add DISABLE_UPDATE_PROMPT="true". I've not had any issues.

Cheers to a focused work experience!

 

Console.app happens to be the best .log file viewer I've ever used, for any logs - not just macOs system ones.

 

Making Recents more useful

Clean Recents list

So if you open Recents in the sidebar it's likely it's full of files you have no idea you recently opened. It's most likely that you didn't. We can make Recents more useful by restricting the last opened date, and make using it more convenient. This is how:

  1. Open Finder, then Recents in the sidebar.
  2. From the cog menu, select Show Search Criteria, add a criteria via the plus button.
  3. Change the filter name to Last Opened Date within last 14 days and press Save.
  4. Name it My Recents, and enable Add to sidebar.
  5. From the sidebar, drag the smart search into the dock next to the Trash.
  6. Optionally remove the recents icon from the sidebar. You can restore the item via Finder > Preferencers > Sidebar by dragging it back in.

As a bonus tip, update  the icon for the smart search (just like any other folder and app) as follows:

  1. Open /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ and search for "Recents" to find the current Recents icon, or choose an alternative.

  2. Right click on the My Recents icon in the sidebar and choose Get Info.

  3. Drag the preferred icon from the folder into the icon slot in the top left of the Get Info window.

This changes the icon in the window title, but I haven't found out how to change it in the sidebar.

 

What is up with macOS font rendering?

What is up with macOS font rendering?

The text in news is a lot blurrier than the text in messages.

 

macOS Catalina

macOS Catalina

Terminal hasn't changed much!

 

What do the macOS menu bar, a clever css filter I came across today, and a great iOS accessibility feature have in common? Grayscale makes for a quiet user experience.

 

Can’t believe the firewall is still off by default in 2019!

 

NPM global installation permission issues on macOS

I had trouble installing global npm packages, which failed due to permission errors. I don't want to use sudo as this will lead to problems later, and I don't want to set the global installation directory to a local directory, as that means other users don't have access to the packages.

As recommended by the NodeJS documentation this is best fixed by installing node via a version manager.

First, remove node which I incorrectly installed with homebrew:

brew uninstall node

Then install nvm as per the official instructions. In my case this also failed as this is a new system that doesn't have a .bash_profile yet. Hower as I wanted to install the zsh shell, I installed oh-my-zsh as per the instructions on their site.

Once zsh was installed (or you've created a .bash_profile using touch ~/.bash_profile, you can install node in a correct manner as follows:

nvm install node

Happy yak-shaving!

 

 

 

I understand why macOS Safari wants to sandbox browser extensions but please add a search option for safari extension instead of a 30 page list… @instapaper do you have a safari extension?

 

What's up with keyboard shortcuts on macos? For many system shortcuts, there's an application shortcut that does something different.

 

I’ve wondered for years why and don’t supply an update service for applications to hook into to keep themselves updated. I guess it’s a lot more complex than building an updater.

 

Fix for Google Chrome Bouncing Forever in the macOS Dock

I had the issue where it was not possible to launch Google Chrome. It would bounce in the dock forever without actually starting. Trashing the application and associated files (with Hazel) did not work.

Other people had the same problem:

The following instructions will help get Chrome back up and running.

The Fix

The solution to this issue is to remove all application settings. Start a terminal:

cd "/Users/`whoami`/Library/Application Support/Google"
mv Chrome Chrome.old
mkdir Chrome
open "/Users/`whoami`/Library/Application Support/Google"

Now start Chrome. If it starts correctly, trash the Chrome.old folder. 

Restoring the folder

If the fix did not work in your case, use the following commands to restore the original folder.

rm -rf Chrome
mv Chrome.old Chrome

Good luck!

 

macOS doesn't use a swap file when running from an external SSD

So I was seeing graphical glitches, freezes and Activity Monitor indicated memory pressure. Turns out macOS doesn't mount a swap file, as I am running from an external SSD install.

This is easily fixed. I can't believe it is a problem though.

By the way I had to change the end of line 4 (because the command in the Ask Different answer returned multiple results) to:

VM_VOLUME=$(/usr/sbin/diskutil list | grep "VM" | awk 'NR==1{print $7;exit }')

It's easy to add the launch item using Lingon X and start it with sudo ./mountvm.sh for the current session.

 

<p style="text-align: left;">There’s a great deal on for <a href="https://flyingmeat.com/store/">Acorn</a> my favourite macOS image editor.</p><p>#status </p>

 

macOS you could fix “recent” finder sidebar to actually show recent results.<p>#status </p>

 

macOS, you could add Automator actions for all the common publishing systems.<p>#status </p>

 

Updating Homebrew for macOS Sierra

If you've just upgraded to Sierra and previously had Homebrew installed you may find that it no longer works because of the stricter security feature in macOS. In order to get Homebrew back up and running you need to execute the following commands in your terminal (thanks thehitmaniptf):

sudo chown -R $(whoami) /usr/local
xcode-select --install

The first command simply gives your local user account ownership of /usr/local (where brew installs things). The second command updates the Xcode command line tools without which Homebrew cannot compile packages.

Once this is done you can successfully update Homebrew as normal, and diagnose any remaining issues:

brew update
brew doctor

After running this you will receive instructions on how to restore the permissions on /usr/local as after updating Homebrew no longer will use this path.

Update 6th Nov, 2016: When using cask you might get told to update the cask room location:

sudo mv /opt/homebrew-cask/Caskroom /usr/local