Mac OS X terminal UTF-8 over SSH
Tuesday, May 21. 2013
Something weird happens in OS X Terminal locale settings. Whenever I open an SSH-connection to one of my Linux-boxes, they refuse to properly set up an UTF-8 locale.
The session goes something like this. Checking locale settings on OS X terminal:
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
Open SSH-connection and check locale settings on Linux end:
~> locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Aow come on! Something went wrong.
The fix on the OS X end is not to set the environment variables. In the Terminal settings, there is:
The setting Set locale environment variables on startup needs to be UNset. It is checked out-of-the-box. Then it yields:
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
The LC_CTYPE is not set. Over SSH-connection to Linux, it yields:
~> locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Now there are no error messages. The next thing to do is to try to find somebody responsible. Whose job it is to fix this.
Something weird happens in OS X Terminal locale settings. Whenever I open an SSH-connection to one of my Linux-boxes, they refuse to properly set up an UTF-8 locale.
The session goes something like this. Checking locale settings on OS X terminal:
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
Open SSH-connection and check locale settings on Linux end:
~> locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Aow come on! Something went wrong.
The fix on the OS X end is not to set the environment variables. In the Terminal settings, there is:
The setting Set locale environment variables on startup needs to be UNset. It is checked out-of-the-box. Then it yields:
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
The LC_CTYPE is not set. Over SSH-connection to Linux, it yields:
~> locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Now there are no error messages. The next thing to do is to try to find somebody responsible. Whose job it is to fix this.
Limiting Time Machine backup size on NAS
Monday, May 6. 2013
Earlier I wrote about getting a Linux-based NAS-box to host Apple Time Machine backups.
I was reviewing my settings on the Mac and realized the text in the Time Machine:

Well... I have lots of disk space there. Not all of it is can be taken by my Mac's backups, so ... Something needed to be done.
I mounted the AFP-share and confirmed the max size of my sparsebundle:
hdiutil imageinfo Mac\ mini.sparsebundle/
It said (unsurprisingly):
Size Information:
Total Bytes: 8855484092416
That is 8+ TiB!! Oh my! There is no way that I can afford to have that much of Apple backups. Luckily there is a way to reduce the size:
hdiutil resize -size 500g -shrinkonly Mac\ mini.sparsebundle/
Now checking the size will yield something reasonable (500 GiB):
Size Information:
Total Bytes: 537214885888
That is something, that I can easily accept.
The information came from:
- http://untoro.wordpress.com/2011/06/07/how-to-limit-space-used-by-time-machine/
- http://nikhilhaas.com/blog/limit-size-of-time-machine-backup-on-wd-my-book-live/
Also I did this to limit the size. I have no idea if it actually does anything.
defaults write /Library/Preferences/com.apple.TimeMachine MaxSize 405600
Perhaps somebody can comment this.
Earlier I wrote about getting a Linux-based NAS-box to host Apple Time Machine backups.
I was reviewing my settings on the Mac and realized the text in the Time Machine:
Well... I have lots of disk space there. Not all of it is can be taken by my Mac's backups, so ... Something needed to be done.
I mounted the AFP-share and confirmed the max size of my sparsebundle:
hdiutil imageinfo Mac\ mini.sparsebundle/
It said (unsurprisingly):
Size Information:
Total Bytes: 8855484092416
That is 8+ TiB!! Oh my! There is no way that I can afford to have that much of Apple backups. Luckily there is a way to reduce the size:
hdiutil resize -size 500g -shrinkonly Mac\ mini.sparsebundle/
Now checking the size will yield something reasonable (500 GiB):
Size Information:
Total Bytes: 537214885888
That is something, that I can easily accept.
The information came from:
- http://untoro.wordpress.com/2011/06/07/how-to-limit-space-used-by-time-machine/
- http://nikhilhaas.com/blog/limit-size-of-time-machine-backup-on-wd-my-book-live/
Also I did this to limit the size. I have no idea if it actually does anything.
defaults write /Library/Preferences/com.apple.TimeMachine MaxSize 405600
Perhaps somebody can comment this.
Mac OS X Dolby Digital 5.1 with Mac Mini [Not solved]
Tuesday, April 9. 2013
Update 30th Dec 2013:
Anything I say below is subject to debate. This issue is not clear, see the new article about Mac Mini HDMI Dolby Digital audio output.
My mini is mainly for entertainment purposes and I chose to use it at living room. That should be an easy setup, right? Just plug the HDMi-output of the mini into my Yamaha amp which is connected to my Sony TV and everything will work out just fine. No.
Video-signal passes through the amp and TV displays it as supposed in correct resolution and frame rate. No glitches there. But the audio-signal has issues, there were only disappointing two channels. I was expecting to see 5.1 channels as my Yamaha amp has been set up already.
First I confirmed that my Mac Mini supported multichannel output (2 channels as stereo is not multi). There is no adapter in my setup (About Mini DisplayPort to HDMI adapters @ Apple support), so initially I had to assume that HDMi-port supports multichannel audio since my model is newer than mid 2010 and newer than early 2009 with adapter. To my understanding 2009 is the point where multichannel audio was possible without 3rd party add-ons. Anyway, I'm way above that line and should have the support.
Apple support forums have vast number of discussion threads about getting 5.1 sound. It is apparent, that for some reason, this is a problematic issue. I'm saying that the reason is: it does not work out-of-the-box as most Apple fans are used to doing everything in the Apple-land.
After numerous failing attempts I finally managed to get my setup working. At one point I realized that my mini is displaying audio status based on my TV, which obviously can produce only stereo sound. There is the amp in the HDMi-chain, and mini should detect audio by that. When I enable multichannel output from OS X:
... my amp does not reflect the change. It still displays the input signal as stereo. This is not typical behaviour. My amp correctly detects the type of the audio signal on all of my other devices. The fact that I missed was, that I can force the amp to do 7-channel signal:
... then 5.1 sound works perfectly.
Testing that everything works ok is very simple: In the MIDI-sound app there is the test-button. When each channel produces sound correctly, I downloaded a couple of movie trailes from http://trailers.apple.com/ and verified that all was as it was supposed to be.
Hope this helps somebody struggling with multi-channel issues.
Update 30th Dec 2013:
Anything I say below is subject to debate. This issue is not clear, see the new article about Mac Mini HDMI Dolby Digital audio output.
My mini is mainly for entertainment purposes and I chose to use it at living room. That should be an easy setup, right? Just plug the HDMi-output of the mini into my Yamaha amp which is connected to my Sony TV and everything will work out just fine. No.
Video-signal passes through the amp and TV displays it as supposed in correct resolution and frame rate. No glitches there. But the audio-signal has issues, there were only disappointing two channels. I was expecting to see 5.1 channels as my Yamaha amp has been set up already.
First I confirmed that my Mac Mini supported multichannel output (2 channels as stereo is not multi). There is no adapter in my setup (About Mini DisplayPort to HDMI adapters @ Apple support), so initially I had to assume that HDMi-port supports multichannel audio since my model is newer than mid 2010 and newer than early 2009 with adapter. To my understanding 2009 is the point where multichannel audio was possible without 3rd party add-ons. Anyway, I'm way above that line and should have the support.
Apple support forums have vast number of discussion threads about getting 5.1 sound. It is apparent, that for some reason, this is a problematic issue. I'm saying that the reason is: it does not work out-of-the-box as most Apple fans are used to doing everything in the Apple-land.
After numerous failing attempts I finally managed to get my setup working. At one point I realized that my mini is displaying audio status based on my TV, which obviously can produce only stereo sound. There is the amp in the HDMi-chain, and mini should detect audio by that. When I enable multichannel output from OS X:
... my amp does not reflect the change. It still displays the input signal as stereo. This is not typical behaviour. My amp correctly detects the type of the audio signal on all of my other devices. The fact that I missed was, that I can force the amp to do 7-channel signal:
... then 5.1 sound works perfectly.
Testing that everything works ok is very simple: In the MIDI-sound app there is the test-button. When each channel produces sound correctly, I downloaded a couple of movie trailes from http://trailers.apple.com/ and verified that all was as it was supposed to be.
Hope this helps somebody struggling with multi-channel issues.