Wednesday, 10 June 2020

MacOSx version from the command line

I have some old disks lying around and in "These Uncertain Times" (TM) was going through them to catalog with Neofinder (stunningly good application for cataloging all sorts of things and especially for offline disks/CDs etc.  Check it out at: https://www.cdfinder.de - unpaid promotion)

One of my disks looks to have a Carbon Copy Cloner backup of an old version of the OS.  I wanted to know which release it was, but realised I didn't know how to under MacOS. The normal Unix-y things of /etc/motd /etc/red-hat-release, etc don't exists as such,  After a few minutes looking around I found the following:

  • The command sw_vers is a command to print out the version of the running OS.
  • The man page for sw_vers refers to /System/Library/CoreServices/SystemVersion.plist
I could just dump the file, but after a few minutes looking at the file, I worked out the following:

  • /usr/libexec/PlistBuddy -c "Print:ProductName" -c "Print:ProductVersion"  -c "Print:ProductBuildVersion" /System/Library/CoreServices/SystemVersion.plist
and by extension:
  • /usr/libexec/PlistBuddy -c "Print:ProductName" -c "Print:ProductVersion"  -c "Print:ProductBuildVersion" /Volumes/Unknown-disk/System/Library/CoreServices/SystemVersion.plist
printed the MacOS version of the disk image in question.

Friday, 5 June 2020

Recording Old LP's using Macintosh only software


The Old Records

I recovered some old records in the attic of my parents house that I'd not seen for a long time and wanted to digitise then to be able to listen to them again.  Unfortunately these had been stored in a plastic box underneath a leaky roof which had filled up with water, and the records were basically sitting in half a pool of water, and had been for at least 3-4 years.

The covers had stuck to the inner sleeves which had also stuck to the records.  Not a pretty sight:



Cleaning the Records

Wash

The first part of recovering these was to remove as much of the cardboard and paper that had stuck to the record as possible. This was done by soaking each on in a bath of hot soapy water and leaving them overnight.  Then gently removing as much of the paper as possible.  For some of the residue that was left, some isopropyl alcohol, cotton buds, and gentle rubbing was used to remove the glue.


However, this didn't get the dirt etc that had been engrained inside the grooves out.  So on to google and part 2.

PVA Glue

Some research showed that PVA glue may be able to help.   I bought some wood PVA glue from my local hardwire store an covered one side of the record with a layer of the glue.  This was all over the vinyl.  I left this to dry for a couple of days until it was 100% clear.  I used a Stanley knife to make a small cut on the lead in track of the record to get my fingernail under the glue and slowly, moved it would until I managed to get a reasonable portion loose.  I then lifted it off radially, and slowly.  It all came of slowly, and in one piece and removed about 99% of the dirt that was in the record.  Success.

Before:

Step 1 after applying the PVA glue:

Step 2 after 2 days drying:

Step 3 starting to remove the glue:

Result:


Recording Hardware

I wanted to use my latest iMac to record, but it doesn't have a line in socket.  My new MacBook pro doesn't either, so I had to go back to an old machine running Lion but it had the correct ports. Enter my first MacBook, the....

MacBook Pro 2006

My old workhorse with 2G of RAM and a 32bit Intel Core 2 duo processor had the correct hardware to be able to record.  The battery doesn't work, so it needs to be powered on the whole time, but it does still work.

Line in, connected from my Record Deck into the MacBook, and a simple grab of the file with QuickTime to save the audio worked. In the end I actually used used Audio Hijack to save to an AIFF file. Sorted.

UCA222 USB Sound

I was trying to find one of these USB sticks to record on my iMac, but they are as rare a hen's teeth at the time of writing, so I couldn't manage this.  Be wary of cheaper USB line in solutions, as 90% of them are Mono only, which won't work well for recording.  They focus on the Stereo output for headphones in the advertising, so look carefully.


Recording Software


CD Spin Doctor

I had an old version to Toast Titanium 10 which included CD Spin Doctor which had the click, pop and hiss reduction along with various other capturing tools.  I was wanting to run this, but it has been discontinued and, according to the Roxio website, only worked well on OSx 10.6.  I can confirm this as I'm running 10.7 on my MacBook, and its doesn't work on that.  Toast Crashes just after startup. Ah well, I thought, I have a VM and so I can fire up an old instance of OSx and run it in there, and also benefit for faster CPU speeds.


VM Fusion

I pulled out an old DVD copy of Snow Leopard (Since I received my first Mac in 2006, I've saved all of the install DVD's and downloaded images "just in case") and copied this to an iso image for Fusion.

Bad news, it seems that Fusion only goes back to 10.7, and I know for running 10.7 on my MacBook, that Toast doesn't work well on it.  A glimmer of hope though, Fusion does support OSX 10.6 server and I did have a valid copy of that with a serial number (Server releases came with registration keys)


Snow Leopard Server

Fire up Fusion, install Snow Leopard server and get it running.  I had to update to the latest patches after installing and install VMware tools.  However, it seems that Fusion running virtual hardware version 9 (or above, I assume) is too recent for Snow Leopard to identify a sound card, so it won't work.


Additional Changes to allow Sound Card

There are 2 ways to get around this.
  1. Shutdown the server, downgrade the virtual hardware on the server instance to 7 and reboot.
  2. Change the audio card setting in the vmx file.
I chose the latter option.  Closed the VM down and then edit the vmx file:
  • I changed sound.virtualDev = "hdaudio" to "es1371".
  • Since the VM didn't have a sound card, I needed to go into the settings for the VM and add a device, and then select 'Sound Card"
  • Another reboot.
One more thing.  I need to install a driver for this sound card, so that it actually works.  Fortunately, the VMware discussion boards came up with a solution: Sound with Snow Leopard Server on Snow Leopard in Fusion 4

I downloaded the package in the VM and ran it.

Sound was appearing and working.  Success.


Transfer of files into and out of VM and processing the audio

The normal way to transfer files in and out with a Fusion VM would be to drag and drop.  For some reason this appeared to work, and then didn't.  In the end I fell back to opening a terminal session and using scp to copy the files into the VM, worked on them with CD Spin Doctor, and then used scp to copy the resultant files back out to my main machine.

Problems with CD Spin Doctor

The main reason to use CD Spin Doctor was the de-click and de-hiss options for the filters.  A secondary use was to split the files into tracks and save them for importing into iTunes later.  Unfortunately, the latter of these features didn't seem to work at all.  Every active track saved was save with the correct meta information, the correct duration, but they all started at the start of the recording, and not where they were supposed to.

Rather than try to work out why this was the case, I just used the CD Spin Doctor filters on the whole audio file and then copied it bak to the main Mac for splitting up with either Fission or Audacity.

After processing them as AIFF format, I then use "MediaHuman Audio Converter" to convert to m4a before tagging and adding to iTunes.



Friday, 6 April 2018

Speed Difference between intel i7 and i5 under MacOS

As I've mentioned before, my old iMac was broken, but I managed to fix it.  In the intervening time, I bought one of the core retina iMacs instead.  Since this was an i5, I decided to benchmark it on some video transcoding that I do a lot of to see the difference between the machines in general.  e.g. # cores, speed, cache etc.  I also ran the comparison on my MacBook Pro as well. All machines have a native SSD and are running the latest build of High Sierra.

Machine information:

New:
  • iMac Retina 5K 2-inch 2017
  • Processor 3.5GHz Intel Core i5 (4 cores)
Old:
  • iMac 27-inch Later 2009
  • Processor 2.8GHz Intel Core i7 (8 cores)
Laptop:
  • Macbook Pro 15-inch Late 2016 (Touch Bar)
  • Processor 2.7GHz Intel Core i7 (8 Cores)
Details of test:
  • Nightly build of HandBrakeCLI from 2018-02-10
  • Uses all available cores if possible, as it's multi-threaded.  A good test of multiple cores.
  • Mp4 file of 1920x1080 resized to 960x270 using Quality of 22.
OldNewLaptop
14m 41s10m 16s13m 26s


Notes:

  • New encoding details:
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x264 [info]: profile Main, level 4.0
  • Old encoding details:
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2

x264 [info]: profile Main, level 4.0
  • Laptop encoding details:
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x264 [info]: profile Main, level 4.0

Conclusion:

  1. The new iMac running at a higher clock speed but with fewer cores is definitely faster than the 9 year old.
  2. The 9 year old iMac still does surprisingly well.
  3. The laptop, even though clocked at around the same speed and with 8 cores, is still slower than the desktop.

Thursday, 15 March 2018

Using a Mac as a second display

As previously noted (here), my old 8 core i7 iMac broke and was subsequently fixed.  In the intervening time, I had bough a new core i5 retina iMac, so the 2009 model is a little bit surplus.  What to do with it?

One option was to use it as a secondary display for the new Mac.  So I bought the correct Thunderbolt to Mini display-port adapter (link to follow), plugged it and suddenly I have 2 27inch displays.  The 2nd was a bit bright, but I discovered the keyboard on the old iMac still works, and I can change the brightness with the function keys.  Great, but that got me thinking.

If the keyboard is still working, what about the rest of the machines.  Articles on the web mention that you can still play music through the iMac while it is being used as a monitor, so what else is working?  As it turns out, everything.

I fired up screen sharing and connected to the old iMac and got the complete screen that I would have seen had the screen not been used in target display mode.  Everything works; Safari, Terminal, Photos, iTunes.  So, if I do need to connect to it and use some of that spare horsepower for video conversion, it's available and can be used.  Big tick for Apple, there.

Fixing a Borken(sic) iMac Display

My 2009 iMac decided to break down in the most unfortunate way just before Christmas.

I normally leave it on all the time, and when I came back to it, the screen looked strange with small yellow blotches all over the screen and was unresponsive.  Since nothing else worked I did the "hold the power down button for 10 seconds" thing to force turn off the machine and waited about a minute before restarting.

Bad news, the progress bar crept to about 70%, then the screen got corrupted again and the boot sequence failed.  This was annoying on more than one way in that I had recently upgraded the 1TB hard disk to a 1TB SSD for massively increased performance. (I would 100% tell anyone who wants to get more performance out of a machine to a) upgrade the RAM and b) upgrade to a non spinning-rust storage instance.  I digress).  So, this is what I was seeing:
I reset the PRAM and booted into safe mode.  This took a very long time, but I did manage to get a login screen and the desktop, but with VERY slow video performance,  and still had 5 yellow/blue stripes down the screen.  After logging in, I could reboot it back into normal mode, but it stuck at the Apple logo screen and failed to continue.
This is what it looked like in safe mode:

Redrawing the screen was painful, as you could almost see it working out what to do.  Video playback didn't work, but I was able to fire up Citrix and work from home for a while, but really, really slowly
.

I did some searching on the web and it looked like it was a video card issue.  Since it was well out of warranty, I phoned my local may authorised repair place and they agreed to take it and have a look.  Unfortunately they confirmed that it looked like a video card issue and there was very little to be done since these cards cannot be sources easily any more and are not manufactured.



So, I bit the bullet and ordered a new 2017 i5  iMac with 1TB SSD and waited for the pain to subside from the payment.

In the mean time, I did look further and found a reference to an iFixit post (see here ) which suggested dismantling the iMac and roasting the GPU in an oven for 10 minutes to rement and dry solder joints.

My hardware experience is very limited.  I added a 1 Mhz to 2 Mhz switch (yes, mega, not giga...) on my first Acorn Atom to boost the 6502 processor, but that really was the level of my hardware experience.

But nothing ventured..., so I bought all of the bits and bobs needed from Maplins (R.I.P.) and 3 weeks ago, after watching both of his video tutorials, decided to bite the bullet and give it a go.

Well, it wasn't easy, but the worst part was putting everything back together.  The ribbon cables on that machine are a real bugger to put back correctly.  I took both videos and went with a combination of removing as little as possible to get to the GPU and then followed the rest of the instructions, eventually baking the GPU card on 4 little foil pyramids.

Put it all back together and it worked.  Booted to High Sierra and all the graphics stuff works perfectly now.

What did I learn from this?

  1. Broken GPU cards can be fixed by baking them in the oven.  It may fail later, but when you're at this stage, anything is worth a try.
  2. Go slow and steady when trying some new hardware stuff.  I disassembled and re-assembled over 3 days giving me plenty of time to make sure I didn't rush anything.
  3. Rare earth magnets are great at pulling screws from your hand, just as you try to screw the LCD panels back into a chassis... :-)



Tuesday, 29 December 2015

Running sshd on El Capitan and compatibility with older versions

To allow myself a login on my home Mac, I open a port on my firewall and allow ssh traffic in.  I use 'prompt' on the iPad and iPhone for ssh access as well as using ssh to start VNC when using 'teleport' to allow sharing go my screen.

This all seemed to break under El Capitain as ssh access via the port over the WAN connection no longer seemed to work.

After some investigation it seems to be the case of the ciphers used by ssh on El Capitan not being as compatible as they could have been with the ssh version on the iPad.

So I did the following:

sudo vi /etc/ssh/sshd_config
And added the following line to the end of the file as one line:

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,blowfish-cbc,aes128-cbc,3des-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
I then could restart ssh on my new port and access it via the iPad/iPhone applications again.

According to the site itefix.net, this it may be related to the potentially incompatible changes introduced in OpenSSH 6.7 to remove unsafe algorithms.

Friday, 4 December 2015

Screen Sharing on El Capitan

Screen sharing on the Mac is really useful.  There are a few ways to do this once screen sharing is turned on in the System preferences pane.


  • You can select the machine name at the side of the Finder and then the "share screen" tab.
  • You can run the 'Screen Sharing' App from Spotlight or directly from "/System/Library/CoreServices/Applications/Screen Sharing"

However, did you know that when you connect via screensharing to different remote, a file is created in your home directory at 
~/Library/Containers/com.apple.ScreenSharing/Data/Library/Application Support/Screen Sharing/
containing information on how you connected to the machine?  The good thing about these files is that they can be used to reconnect to the machines by just double clicking on them.  This means that you can use screen sharing to connect to a machine much faster than the two methods shown above.

To make this more convenient for me to use I did the following.

  • Created a folder in my home directory called "Remote Machines"
  • In the Finder, select "Go" and then press the "ALT/Option" key to show the hidden folder 'Library" and then navigate down to ~/Library/Containers/com.apple.ScreenSharing/Data/Library/Application Support/Screen Sharing/
  • Option/ALT click and drag all of the files to the "Remote Machines" folder created above to copy them, rather than move them.
  • Drag the "Remote Machines" folder into the right-hand side of the dock (to the right of the faint-white lines which separate the Trash from applications)

Now when you click on that folder in the dock, you'll see a list of machines that you can connect to directly.  You can add to this folder at any time when you connect to new machines.

Note that this is not limited to other OSX machines, the files are also created if you connect with a standard VNC protocol to another machine running VNC.  e.g. Linux VNC server, Raspberry Pi VNC server etc.

Now that the folder has the links to start off a screen sharing session, the icons can be changed to make them more meaningful.  Follow my post on this for details on how to do this in El Capitan.

The same method can be used under previous versions of OSX, but the location of the Screen Saring folder is different.  e.g. under Lion they are held under:

~/Library/Application Support/Screen Sharing/

Other locations in other releases are left as an exercise for the reader.