Category Archives: Mac OS X

Testing Network Transfer Speed Between unRAID and macOS

This post is a follow up to the previous post about creating RAM disks on unRAID and macOS in order to test network transfer speeds. I actually used this method first, as it was the easier of the two and gave me exact transfer rates. The key is to use iPerf3.

Installing iPerf3 on unRAID

Installing iPerf3 on unRAID is a snap using the excellent Nerd Pack plugin. Assuming you have the Community Apps (CA) plugin installed, navigate to the Apps tab and search for “nerd”. Click on the resulting Nerd Pack link in the drop down to install the plugin.

Once installed, click on the gear icon (settings) for Nerd Pack. You will be presented with a long list of packages that can be installed. Scan down until you find:

iperf-3.1.6-x86_64-1cf.txz

the latest version when this post was written. Just click the slider on the far right to ON and the package will be installed.

Running iPerf3 in Server Mode on unRAID

Click the Terminal icon >_ in the upper righthand corner of the unRAID window, right below the Uptime display. In the Terminal window that pops up, type the following command:

iperf3 -s

You will see the following server response letting you know it’s listening:

------------------------------------------------
Server listening on 5201
------------------------------------------------

Installing iPerf3 on macOS

The easiest way to install iPerf3 on macOS is to use Homebrew. If you don’t have Homebrew installed, click the Homebrew link in the previous sentence and it will take you to the install instructions. Once Homebrew is installed, installing iPerf3 is as easy as typing the following command in a Terminal window:

brew install iPerf3

Running iPerf3 in Client Mode on macOS

Now that iPerf3 is installed, just type the following command to test your network speed:

iperf3 -c xx:xx:xx:xx

where xx:xx:xx:xx is the IP address of your unRAID server (or more specifically, depending on your setup, the IP address of the 10 GB NIC in your unRAID server). After issuing that command, Terminal will print out (something similar to) the following (in both the client and server terminal windows):

[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  1.09 GBytes  9.35 Gbits/sec                  
[  5]   1.00-2.00   sec  1.08 GBytes  9.30 Gbits/sec                  
[  5]   2.00-3.00   sec  1.09 GBytes  9.40 Gbits/sec                  
[  5]   3.00-4.00   sec  1.09 GBytes  9.37 Gbits/sec                  
[  5]   4.00-5.00   sec  1020 MBytes  8.56 Gbits/sec                  
[  5]   5.00-6.00   sec  1.04 GBytes  8.94 Gbits/sec                  
[  5]   6.00-7.00   sec  1.09 GBytes  9.38 Gbits/sec                  
[  5]   7.00-8.00   sec  1.09 GBytes  9.35 Gbits/sec                  
[  5]   8.00-9.00   sec  1.09 GBytes  9.40 Gbits/sec                  
[  5]   9.00-10.00  sec  1.07 GBytes  9.20 Gbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.00  sec  10.7 GBytes  9.23 Gbits/sec                  sender
[  5]   0.00-10.00  sec  10.7 GBytes  9.23 Gbits/sec                  receiver

Congratulations, you are now riding the light at 10 Gig speeds!

Creating a RAM disk in unRAID (and macOS)

I’ve been playing around with unRAID for about a month now and find it very interesting. I just purchased 2 10 GBE ASUS/Aquantia NICs and wanted to test the network transfer speed.

Unfortunately, one quickly finds out the Array and/or SSD cache read speeds become the bottleneck and you don’t see the full 10 Gbps throughput. In order to mitigate this, I created a RAM disk on the unRAID server and then another RAM disk on my Hackintosh. Creating the macOS RAM disk is easy but it took some digging to find how to create a RAM disk on unRAID. Hopefully this will help anyone trying to create a RAM disk on unRAID moving forward.

Creating a RAM disk in unRAID

  1. Stop the Array.
  2. Go to Settings > SMB
  3. In Samba extra configuration, paste the following:
[ramdisk]
path = /mnt/ramdisk
comment =
browseable = yes
public = yes
writeable = yes
vfs objects =
  1. Click Apply, then Done.
  2. Restart Array.
  3. Mount your Flash drive/share
  4. Open the Go file (inside the Config folder) using a text editor.
  5. Paste the following:
mkdir -p /mnt/ramdisk
  1. Save the Go file.
  2. Reboot the unRAID server.

While the ramdisk will not show up under the Shares tab, it will show up as a share when you connect to your unRAID server. It will also show up in Krusader under /mnt/ramdisk. The size of the RAM disk defaults to half of the available RAM.

Creating a RAM disk in macOS (Catalina)

  1. Open the Terminal app and enter the following command:
diskutil partitionDisk $(hdiutil attach -nomount ram://8388608) 1 GPTFormat APFS 'RAMDisk' '100%'

This will create a 4GB APFS formatted RAMdisk. The RAM amount is specified in blocks. You calculate the RAM amount as follows:

2048 (blocks) * RAM disk size in MB (1GB = 1024MB)

4GB RAM disk = 2048 * 4 * 1024 = 8388608

1GB RAM disk = 2097152

Enjoy!

Resize a sparsebundle Disk Image in Terminal

I was trying to resize a sparsebundle disk image using Disk Utility and kept getting the error that the image resize had failed. The selected disk image could not be resized. Terminal to the rescue. The following command resized my disk image without any issues:

hdiutil resize -size XXXg /pathTo/diskimage.dmg

Change XXX to the size you would like, enter the path to your disk image Terminal may spit out some lines of “text” but you can ignore those. This process will resize the disk image but it has not expanded the container. Find the physical stores name (disk name) for your disk image either using the Disk Utility app or via the Terminal with the following command:

diskutil list

Once you have the correct disk name, eg. disk4s1, enter the following command into Terminal to expand the container:

diskutil apfs resizeContainer disk4s1 0

Terminal will show you the progress of the expansion. I found I had to unmount and then remount the disk image for the Finder to show the correct size, which you can also verify using Disk Utility.

pydotplus on macOS

I’ve been playing around with SciKit-Learn’s decision tree regression function. In one of the examples I was working on, they provided a demo script to print out a jpg of the decision tree. Cool! Unfortunately, my system didn’t have pydotplus installed. I’m using Anaconda, so issuing the following command took care of that issue:

conda install -c conda-forge pydotplus

However, when attempting to run again, this produced and error stating that the GraphViz executable could not be found. Ugh. Luckily, a quick trip to Homebrew took care of that issue:

brew install graphviz

Voila!

Move to Trash Deletes Immediately

I had this issue when I first updated to macOS Mojave. To solve it, I performed the following command in Terminal:

sudo rm -Ri ~/.Trash
[enter your password]

Then, Log out. Log back in. Move to Trash now works as expected.
Note: You can implement Delete Immediately… by holding down Option-Command-Delete.

Installing GCC-7.3.0 on macOS High Sierra

I talked about getting GCC-5.3.0 running in a previous post. As part of some benchmark testing I’m doing for a new computer build, which I hope to write about in a future post, I ventured back into the world of parallel programming. I used the excellent instructions from Solarian Programmer found here to get GCC-7.3.0 running on macOS High Sierra 10.13.3.

Strictly speaking, the link above points to instructions for compiling GCC-7.1.0. While it’s not a big deal to modify these instructions for 7.3.0, here’s a text document with just the command line instructions to get 7.3.0 up.

Note: I did have to make one small deviation from the instructions provided in the link (as noted in the text document attached). I tried to “make” GCC7.3.0 with “make -j 4” but it failed, stating it couldn’t fine “<ctime>”. I retried the make using “make -j 1”, which took a LONG time but worked. I would try 4 first and only if it doesn’t work, try 1.

My previous post also talked about getting OpenMP/Clang running in Xcode and the link provided there works. I did try the steps but couldn’t get it to work. Maybe I’ll try again later but for now, I’m using the command line to compile the OpenMP code.

Allowing different orientations by device (iPad vs iPhone)

I’ve been watching the Developing iOS 11 Apps with Swift podcast (yes, iTunes U content is now available as podcasts, which is cool because you can view them on your Mac) and playing around the Concentration app. This app really wants to be Portrait on an iPhone but Portrait or Landscape on an iPad, given the whole master/detail thing.

I searched for ways to do this and while apparently you can do this in code, this method is super simple. You can add another Custom iOS Target Property to your Info.plist under the Info tab of your project’s target, specifically for iPad. The main one is:

Supported interface orientations

The iPad specific one is:

Supported interface orientations (iPad)

Here’s a screen shot to show it in action.

Hope this helps!

Installing Octave 4.2.1 on macOS Sierra

I’ve been using version 4.0.3 of Octave for some time, installed via the binary available from SourceForge. It works reasonably well, with the exception of having to return to Terminal to enter commands for paged output. I wanted to move up to the current version and managed to get version 4.2.1 installed using HomeBrew. In case you are interested, here are the steps I followed:

  1. Open Terminal
  2. Enter the command: /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
  3. Press RETURN
  4. Install homebrew/science using the following command: brew tap homebrew/science
  5. Octave requires XQuartz, install using: brew cask install XQuartz
  6. Install Octave using the following command: brew install octave
  7. Wait for a bit, then installation finishes

At this point, I “cd’ed” to the bin directory and attempted to run Octave with the following command:

cd /usr/local/Cellar/octave/4.2.1_2/bin/
./octave

Sadly, this produced the following error:

dyld: Library not loaded: /usr/local/opt/hdf5/lib/libhdf5.100.dylib
  Referenced from: /usr/local/Cellar/octave/4.2.1_2/libexec/octave/4.2.1/exec/x86_64-apple-darwin16.5.0/octave-gui
  Reason: image not found
octave exited with signal 6

After some poking around Brew’s install of Octave, I noticed the library in question (located at: /usr/local/opt/hdf5/lib/) had been updated to version 101 (libhdf5.101.dylib), instead of the expected 100 version. I also noticed there was a symlink from libhdf5.dylib to libhdf5.101.dylib. So I just duplicated that symlink, renamed it libhdf5.100.dylib and reran the ./octave command. Everything works!

 

P.S. I made a small text file that contains the following:

#!/bin/bash
# Runs Octave 4.2.1

/usr/local/bin/octave

and saved it to the Desktop with the filename Octave.command. Then in Terminal, I made it executable by running the following: chmod +x Octave.command

You can now double-click this file to run Octave!

OpenMP Clang in Xcode

I’ve been playing around with prime numbers recently, which (naturally?) extended into an investigation into parallel programming. I installed the latest version of GCC 5 (v5.3.0 at the time of writing) using these instructions and got OpenMP running (support is built-in). I’m fine with using Terminal but I thought it would be interesting to try this in Xcode.

I installed the OpenMP C/C++ language extensions for Clang using homebrew with instructions from here. Unfortunately, I received the following error:

can't exec '/usr/local/bin/clang++-omp' (No such file or directory)

It turns out those instructions were missing a symlink that needs to be created. It’s as follows:

sudo ln -s /usr/local/bin/clang-omp++ /usr/local/bin/clang++-omp

Thanks to Stack Overflow for the “full” instructions. I can now build and run C++ parallelized code directly inside Xcode. I am finding a performance difference running the same code via the Terminal vs inside Xcode (which is slower). Hmm…

Solving iTunes 3014 Error

For whatever reason, probably because I do iPhone development and am always installing “stuff” on my computer and iOS devices, I’ve run into the dreaded iTunes 3014 error consistently when trying to restore my iPhone/iPad to put a new OS on it. I swear I tried this before and it didn’t work but I just followed the steps below and everything is updating nicely. iOS 9 GM!

  1. Open Terminal and cd to the /etc folder.
  2. Using your editor of choice, mine is nano, open the hosts file (sudo nano hosts).
  3. Enter your password.
  4. Add the following line to the bottom of the file: 17.151.36.30 gs.apple.com
  5. Write out/save the hosts file and exit (ctrl-O then ctrl-X for nano).
  6. Finally, flush the DNS cache with this command: dscacheutil -flushcache
  7. All done!