Disable Dark Mode for Specific App in MacOS X Mojave

MacOSX Mojave Dark Mode is what I prefer for most apps I use, but in Spark Mail App, Google Groups Digests look like crap:

To fix this you have to disable Dark Mode for the specific app, but Apple doesn’t provide any way to choose apps that should not use it. Time for a hack:

To force an application to use the standard interface mode instead of Mojave Dark Mode (in my case Spark MailApp), quit Spark and in a Terminal issue the following command to get the Bundle Identifier for the app:

osascript -e 'id of app "Spark"'

This command returns:

com.readdle.smartemail-Mac

for the Spark Mail App, but use it for any app you want.
Use the identifier to issue the command to turn off Dark Mode:

defaults write com.readdle.smartemail-Mac NSRequiresAquaSystemAppearance -bool yes

Start your application again and it runs in “regular mode”.

The command is reversible, just swap out the “-bool yes” part with “-bool no“, and you’re back to using Dark Mode.

Now my Google Groups Digest message looks a bit more readable!

The sad part is that I must use “Light Mode” for Spark, but until the developers fixes the rendering of messages like these, I have no choice.

Readability counts.

Advertisements

Strong Password Generator in MacOS X

Using Keychain Access as a Password Generator

Did you know that MacOS X’s Keychain Access comes with a built-in password generator?
I usually save my passwords to iCloud via Safari’s Keychain integration, but sometimes I need to create a new password manually.

  1. Open Keychain Access
  2. Click the + icon in the upper left corner
  3. This brings up a tool that generates strong random passwords
  4. You can choose different kinds and lengths for your passwords
Keychain Access Password Generator :)

No need for external apps to create passwords! 

Add Markdown Search Support to Mac OS X Spotlight

Markdown to Spotlight

You can do this without disabling SIP by creating a copy of the system RichText.mdimporter, modifying its Info.plist and saving it in /Library/Spotlight.

  1. cp -r /System/Library/Spotlight/RichText.mdimporter ~/
    (This copies the .mdimporter to the root of your user home directory)
  2. You can either use an editor from the command line, or go to a Finder window in your Home folder and do a “Show Package Contents” on the RichText.mdimporter file bundle to get to the Info.plist file and open it with Text Edit or another Text Editor.
    Open the: RichText.mdimporter/Contents/Info.plist Markdown.mdimporter/Contents/Info.plist file and add:

<string>net.daringfireball.markdown</string>

to the array of LSItemContentTypes in that file:

markdown-finder.png
  1. Rename the RichText.mdimporter to Markdown.mdimporter:
    mv ~/RichText.mdimporter Markdown.mdimporter
  2. Copy the new .mdimporter to /Library/Spotlight:
    sudo cp -R ~/Markdown.mdimporter /Library/Spotlight
  3. Use the mdimport command to add it to the metadata indexing system:
    mdimport -r /Library/Spotlight/Markdown.mdimporter
    This command asks the server to reimport files for UTIs claimed by the listed plugin.
  4. It should re-import the files automatically after the previous caommand, but if you wish, you can always re-index the whole drive to include the new filetype by rebuilding the whole Spotlight index:
    sudo mdutil -E /
    (This will take some time, and is rather resource demanding)

But now you should be good to go with .markdown files being indexed by Spotlight!

GarageBand Crashing in MacOS X “Mojave”

GarageBand 10.3.1 Crashes on startup in OS X Mojave

Yesterday I installed a fresh version of GarageBand from the Apple App Store.

I didn’t open it after the initial download, but installed IK Multimedia’s AmpliTube 4, so I could play with my newly purchased iRig HD 2.

Then, when I tried to fire up GarageBand I got an application crash notice, and was unable to use the application. Tried several times, before deciding to investigate the generated Crash Report. 

This can be found in the MacOS ‘Console’ utility, in the User Reports section.

I examined the crash log, and found this:

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Illegal instruction: 4
Termination Reason:    Namespace SIGNAL, Code 0x4
Terminating Process:   exc handler [1282]

Application Specific Information:
dyld: launch, running initializers
/usr/lib/libSystem.B.dylib
Sandbox creation failed: Container object initialization failed.
You don’t have permission to save the file “Application Support” in the folder “Library”.
NSCocoaErrorDomain:513 
 
createDirectoryAtPath:withIntermediateDirectories:attributes:error:
WR/DST: ~/Library/Containers/com.apple.garageband10/Data/Library/Application Support

Because I installed the AmpliTube 4 application the other day, the permission errors seemed to be caused by the IK Multimedia AmpliTube 4 installer changing permissions on the following directory:

~/Library/Containers/com.apple.garageband10

The IK Multimedia AmpliTube 4 Installer puts a file link in the following location:

/Users/user_name/Library/Containers/com.apple.garageband10/Data/Library/Preferences/com.ikmultimedia.AmpliTube 4.plist

And it seems that it also changes the permissions in its parent directory (PS! I’ve changed my actual user name with “user_name” in this article):

/Users/user_name/Library/Containers/com.apple.garageband10

So I went checking the permissions with ls -la:

drwx------+   4 root    wheel    128 Nov 16 18:58 com.apple.garageband10

It looks as if the AmpliTube installer removes the regular user account from the directory permissions altogether and changes owner and group of the directory to root : wheel, and the only access granted is to the root user.

It also adds an additional ACL attribute as displayed by the + sign in this listing.

This makes it impossible for GarageBand to install the needed files into this directory as MacOS doesn’t use the root user when installing applications.

Fixing the permissions

The correct permissions for every other directory in the parent path seems to be:

drwx------    4 user_name  staff

Start by running this command to change ownership back to the defaults:

sudo chown -RH user_name:staff /Users/user_name/Library/Containers/com.apple.garageband10

You must use sudo in the command because the directory has been set to not be owned by you.

This restores ownership of the directory structure to your user name and the staff group and a new ls -la listing confirms this:

drwx------+   4 user_name  staff    128 Nov 16 18:58 com.apple.garageband10

Now you can restore the permissions on the directory to the same as for the other directories in the parent path with the chmod command. As we now ‘own’ the directory again, no sudo is needed:

chmod -R 0700 /Users/user_name/Library/Containers/com.apple.garageband10

After this, the listing displays:

drwx------+   4 user_name  staff    128 Nov 16 18:58 com.apple.garageband10

Still, there is the extra ACL attribute on the directory, not present in any of the other directories in the directory structure, so let’s remove it with the following command:

chmod -R -N /Users/user_name/Library/Containers/com.apple.garageband10

A new listing now confirms that the permissions and ACL’s on the GarageBand directory is now the same as on the others:

drwx------    4 user_name  staff    128 Nov 16 18:58 com.apple.garageband10

After launching GarageBand again, this time it starts as it should, displaying the following:

success.png

Yes, it works!

Hope this can help others experiencing same issues when launching GarageBand in MacOS Mojave or other versions and experiencing problems related to permissions in Library.

I’ve joined LinkedIn! Please help me build a professional comp. sci / CGI network!

Hi there, dear readers of this blog!

I’ve recently joined LinkedIn, and I’m trying to build a network consisting of the best in the computer science, software engineering and CG industries.

I’ve gotten a couple of big fish allready, but my network is still super-tiny!

I’m hoping to use this network for both socializing and for sharing technical issues and to present new thoughts and ideas for future products.

I believe a network fusion of these three industries will be an important avenue for anyone interested in fronting their work on the public arena, absolutely free.

So please join and invite anyone you think should be in there. Anybody with a passion and some talent in any of these three fields are very welcome to join!

So please check my profile and join my network over at:

http://www.linkedin.com/pub/chris-sederqvist/57/713/103/en
Vis Chris Sederqvist sin LinkedIn-profilVis profilen til Chris Sederqvist

Some GNU Emacs hotkeys for ya!

I’ve collected some of the Emacs shortcuts / keyboard hotkeys I find myself using from time to time! 😉

Please visit:
GNU Emacs for Unix/Linux and precompiled Windows binaries
Aquamacs for OS X (I prefer this over http://emacsformacosx.com/ as it is better integrated)

To get a hold of this incredible “editor”. The reasons I write “editor” is because calling Emacs an editor is something of an understatement! It’s more like a little operating system or at least an intelligent Lisp world!

For you guys never bothered to learn Emacs: You don’t know what you’re missing out on!

Ok, here are the hotkeys (feel free to add some as a comment, and I’ll add them to the list!):

General commands:

c-x c-f = new buffer (file)
c-x c-c = quit
c-g = cancel input command
c-v next page
m-v previous page
c-l toggle cursor point up/down/center (pgUp/pgDown)

Navigation in text:

c-p = previous line
c-n = next line
c-b = backward
c-f = forward
m-f = move forward Word-by-word
c-a = beginning of the line
c-e = end of the line
m-a = beginning of the sentence
m-e = end of the sentence

m-< = beginning of the text
m-> = end of the text

Editing Text

Killing text:
(text goes to a safety buffer like in Cut)

m-backspace = kill word before cursor
m-d = kill word after cursor
m-k = kill words until end of sentence (.)
c-k = kill words until end of line
c-space = mark start of delete (move to end of text to delete)
c-w = delete text from mark until here
c-y = yank (paste) text from last kill buffer
m-y = cycle through the kill buffer entries

c-x u = undo
c-_ = undo too!

Search for text:
c-s = search forward in buffer from cursor
c-r = search backwards in buffer from cursor

for a non-interactive search press enter before search word.

Search and replace:
m-x replace-string + enter
<word to replace>
<word to replace with>

Managing buffers and windows

c-x c-b = display buffer list
c-x o = switch to buffer list, select with arrows and enter
c-x b = start typing the name of the buffer to choose (tab-complete)

c-x 1 = one buffer in window
c-x 2 = two buffers in window horizontal
c-x 3 = two buffers in window vertical

c-x 0 = close active buffer (file)

m-x recover-file = recover file after crash (open original file, not auto-backup)

c-u 90 c-x f = set margin width to 90 chars

c-u 0 c-l = move current line to top of buffer window
c-x o = move cursor to “other” buffer window
c-m-v = scroll through other window (keeping cursor in main window)

m-x make-frame = create an independent Emacs frame

esc esc esc = get out of recursive editing level mode

c-h f <function> = help on <function>
c-h k <command> = help on <command>
c-h a <keyword> = search for <keyword> in help
c-h i m Emacs = read Emacs manual using info

That is something to get you started!

Until next time, happy editing!

Chris

Setting up Mental Ray Satellite with Windows slave and Mac OS X host

I don’t know why, but every time I have to set up Mental Ray between different platforms I always stumble some before everything works perfect. Today I configured my quad core Windows computer to do the chewing when rendering from my MacBook Pro laptop.

This is a super-simple setup, but somehow it wasn’t all click and go today either. First of all, I had the slave machine configured earlier, so when I tried to telnet into the port I googled about it would not connect from my Mac host.
So, I checked with the \Windows\System32\Drivers\etc\services file on the Windows machine and got the correct port number 7412 for satellite connections, then I created the maya.rayhosts file in the preferences folder on my mac containing one simple machine.

(File: /Users/chris/Library/Preferences/Autodesk/maya/2012-x64/prefs/maya.rayhosts):
192.168.1.152:7412

After disabling the local network firewall on Windows, it sort of worked, but I got this annoying error message from Mental Ray after the render:

MSG  0.0  info : adding new host 1 (192.168.1.152:7412)
MSG  0.0  error  011330: mi-ray/tcp: not a service (check /etc/services)
MSG  0.0  warn   012219: using fallback inet service 7003

Then I tried to add the correct port for satellite (a different port than the one used with MR Stand alone btw) to the /etc/services.
This did not help either.

But, when I also added the “fallback service”, inet 7003/tcp to /etc/services it managed to actually shut up!

# /etc/services
# Mental ray satellite
mi-ray7412/tcp
inet		7003/tcp

So, if anybody out there experience the same “error” message, you know what to do…
BTW, the error doesn’t stop the render from running, but I believe maybe a nanosecond or two will be wasted if the ports don’t match up and the system has to mage a different route… Who knows?