Silence fitbitd console messages

I found Fitbitd (the Fitbit running daemon) sending tons of strings like this to console:

Aug/11/2011 14:57:32 	com.fitbit.fitbitd[351]	Thu Aug 11 14:57:32 mycomputer.local MacUserInterface[351] : [9A] 0x00, 0x3b, 0x61, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00
Aug/11/2011 14:57:32 	com.fitbit.fitbitd[351]	Thu Aug 11 14:57:32 mycomputer.local MacUserInterface[351] : [0A] 0x00, 0x01, 0x0a, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00
Aug/11/2011 14:57:32 	com.fitbit.fitbitd[351]	Thu Aug 11 14:57:32 mycomputer.local MacUserInterface[351] : [05] 0x00, 0x01, 0x05, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00
Aug/11/2011 14:57:32 	com.fitbit.fitbitd[351]	Thu Aug 11 14:57:32 mycomputer.local MacUserInterface[351] : Pending acks: 0
Aug/11/2011 14:57:32 	com.fitbit.fitbitd[351]	Thu Aug 11 14:57:32 mycomputer.local MacUserInterface[351] : [9B] 0x00, 0x3c, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
Aug/11/2011 14:57:32 	com.fitbit.fitbitd[351]	Thu Aug 11 14:57:32 mycomputer.local MacUserInterface[351] : Pending acks: 0
Aug/11/2011 14:57:32 	com.fitbit.fitbitd[351]	Thu Aug 11 14:57:32 mycomputer.local MacUserInterface[351] : Received logical packet.
Aug/11/2011 14:57:32 	com.fitbit.fitbitd[351]	Thu Aug 11 14:57:32 mycomputer.local MacUserInterface[351] : Received terminating status packet.

So, I silenced these by altering the top of /Library/LaunchDaemons/com.fitbit.fitbitd.plist
Note: the -e switch I obtained from:

fitbitd --help

from:

<key>Program</key>
<string>/usr/local/bin/fitbitd</string>

to:

<key>ProgramArguments</key>
   <array>
      <string>/usr/local/bin/fitbitd</string>
      <string>-e</string>
   </array>

Vemedio Snowtape RadioAgent

In Mac OS X (10.6 Snow Leopard), after closing Snowtape version 2.0.4, I see in Activity Monitor there is a service/process running named RadioAgent. In Snowtape under Preferences → Recording → “Enable automatic wakeup from sleep”, is NOT checked, and thus I expect all related processes to quit when I exit the program. However, this is their response to this:

This is intended behavior. The RadioAgent has a purpose. I won't go into any 
detail. If you kill the agent manually you might get unexpected behavior we can 
not support.

If you do want to stop or deactivate the RadioAgent (for example, you are trying to upgrade Snowtape and get the message “The operation can’t be completed because the item ‘RadioAgent’ is in use”.) is this the Terminal command to use:

launchctl remove com.vemedio.Snowtape.RadioAgent

Mac OS X: Mounting FAT32 external hard drive via Terminal command line

I have a 150GB USB external hard drive (IDE/Parallel ATA disk in an enclosure) which was formatted as one partition, FAT32 in Windows XP. I wanted to extract the files off of it using my Macbook Pro running Apple Macintosh Leopard (Mac OS X 10.5.6).

However, when I plug it in, I get a dialog box which says:

Disk Insertion
The disk you inserted was not readable by this computer.
Initialize...   Ignore   Eject

I saw many references to there being a 127GB or 128GB partition limit for FAT32 for Mac to successfully mount.

Also, a potential problem was that when using Disk Utility it shows up on my system incorrectly as formatted as a Windows NT Filesystem (NTFS-3G).

diskutil list disk3

Output:

/dev/disk3
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:     FDisk_partition_scheme                        *149.1 Gi   disk3
1:               Windows_NTFS                         149.0 Gi   disk3s1

It did however mount automatically and show up when I was running a virtual machine, for example Parallels and Windows XP (I used VirtualBox and Windows 7), but copying over files this way proved to be very slow.

So, after spending a lot of time on the internet looking for solutions, I just tried mounting it from the Terminal (command line) with success!

First, make a mount point:

sudo mkdir /Volumes/EXT_HD

Now mount (your device numbers may be different, e.g. /dev/disk2s1 — you can determine what it is as it will the the highest number when you issue the command ‘ls /dev/disk*’):

sudo mount -t msdos /dev/disk3s1 /Volumes/EXT_HD/

It eventually showed up in Devices in Finder, but just to let you know, when I tried ejecting (unmounting) it when I was done, even though I had closed all programs I got the error:

The disk “USB_DRIVE” is in use and could not be ejected. Try quitting applications and try again.

Unmounting via he command line also failed:

sudo umount /Volumes/EXT_HD/
umount: unmount(/Volumes/EXT_HD): Resource busy

So I had to reboot.

I hope someone finds this information useful because I sure didn’t find any help…

EDIT (01 Oct, 2009): Apparently there is a way to enable native NTFS read/write support in 10.6 Snow Leopard (and this may work for Leopard). However, I would recommend not allowing write ability (and thus read only) when using this method as it may corrupt your NTFS files. To set to read only, follow the directions in the link but instead of using ‘rw’, use ‘ro’, e.g. UUID=123-456-789 none ntfs ro

How to handle deleting trash in Thunderbird when using IMAP Gmail

The Google team about a year ago added IMAP services to gmail. This is a great way to be able to manage your mail from several different places (e.g. client software at work, and web based gmail page on the road) and have everything automatically be in sync.

I’m also a big fan of the open source Thunderbird email client. But there is one annoying thing using these two together: when you have a message selected and press ‘delete’, normally this sends the message to Thunderbird’s trash (which completely removes it from Gmail), but in this case, you want to send it to Gmail’s trash.

There was a configuration setting you could try, to send the message to [Gmail]/Trash, but Google doesn’t recommend it (see ‘UPDATE 2, Nov 8th’ here). Instead you are supposed to move (e.g. drag-and-drop) the message to the [Gmail]/Trash folder manually.  Well, that’s not too convenient when you have a lot of folders. So, what I’ve found is an add-on QuickFolders which will easily make a shortcut to that folder (and others) so that you can more easily drag-n-drop to send that message to gmail’s ‘Trash’.

libtiff error in Matlab when attempting to use ImageMagick

Trying to use the Imagemagick toolbox (for me, installed via MacPorts) sometimes doesn’t work (for example, converting a png image) in Matlab because Matlab for some reason uses the libraries in its path over those given in system call (this is for Mac, but probably for *nix and maybe even Windows).

This is an example call:

[s,w] = system([IMAGEMAGICK_PATH,'convert ',pwd,'/',outfile,'.png -rotate 90 ',pwd,'/',outfile,'.png']);

This is the error:

error:
dyld: Library not loaded: /opt/local/lib/libtiff.3.dylib
Referenced from: /opt/local/bin/convert
Reason: Incompatible library version: convert requires version 12.0.0 or later, but libtiff.3.dylib provides version 11.0.0

The work around is to replace the Matlab library with the ImageMagick one (only need to do this once and will stay until you upgrade Matlab):

cd /Applications/MATLAB74/bin/maci/   (or wherever your Matlab is installed)
mv libtiff.3.7.1.dylib  libtiff.3.7.1.dylib.MATLAB  (give it a different name)
ln -s /opt/local/lib/libtiff.3.dylib libtiff.3.7.1.dylib  (create a soft link to the Imagemagick library file)

EDIT: This is the much better way to handle this:

setenv('DYLD_LIBRARY_PATH',['/opt/local/lib/:' getenv('DYLD_LIBRARY_PATH')])

Serial Port communications on Mac via Matlab

I have a rev B (Core 2 Duo from Dec, 2006) Apple MacBook Pro laptop running Leopard OS X (version 10.5.2) and have Matlab version 7.5.0.338 (R2007b). I’ve just found that I can NOT use the built-in serial port object, instead, I get the following error:

 java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
??? Error using ==> serial.serial at 57
The serial port object is supported on the Solaris, 32-bit Windows and 32-bit Linux platforms only.

So, to get it successfully working, I downloaded these files: SerialComm.m, SerialComm.mexmac and SerialComm.mexmaci from http://svn.berlios.de/svnroot/repos/osxptb/stable/Psychtoolbox/PsychHardware/.

You can then use code like this:

 PORT = 1;
% close (if previously open)
SerialComm( 'close', PORT)
% open
SerialComm('open',PORT,'9600,n,8,1')
% flush the buffers
SerialComm( 'purge', PORT)
% status
SerialComm( 'status', PORT)
% read
STR = SerialComm( 'readl', PORT);
% close
SerialComm( 'close', PORT)

[UPDATE 02 Apr, 2008]: Note, this same code didn’t seem to work on a recently purchased Macbook. Good luck.

[UPDATE 27 Mar, 2009]: I see that in Matlab version 7.8.0 (R2009a) if you go to ‘serial’ in Help docs it now says for Mac OS X and Mac OS X 64 you can use serial(‘/dev/tty.KeySerial1’); I don’t have a way of testing that right now, but it’s possible that you don’t need to use this third party toolkit anymore. If that’s true, please leave a note here.

Getting tcl via macports to compile on Leopard

With a fresh install of MacPorts version 1.6.0 on Mac OS X 10.5.2 Leopard, then issuing the command:

 sudo port install tcl

returned:

 /usr/local/include/mach-o/arch.h:35: error: nested redefinition of 'enum NXByteOrder'
/usr/local/include/mach-o/arch.h:35: error: redeclaration of 'enum NXByteOrder'
/usr/local/include/mach-o/arch.h:36: error: redeclaration of enumerator 'NX_UnknownByteOrder'
/usr/include/architecture/byte_order.h:137: error: previous definition of 'NX_UnknownByteOrder' was here
/usr/local/include/mach-o/arch.h:37: error: redeclaration of enumerator 'NX_LittleEndian'
/usr/include/architecture/byte_order.h:138: error: previous definition of 'NX_LittleEndian' was here
/usr/local/include/mach-o/arch.h:39: error: redeclaration of enumerator 'NX_BigEndian'
/usr/include/architecture/byte_order.h:140: error: previous definition of 'NX_BigEndian' was here
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c: In function 'TclpFindSymbol':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:382: warning: 'NSLookupSymbolInImage' is deprecated (declared at /usr/include/mach-o/dyld.h:182)
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:415: warning: 'NSLinkEditError' is deprecated (declared at /usr/include/mach-o/dyld.h:217)
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:419: warning: 'NSLookupSymbolInModule' is deprecated (declared at /usr/include/mach-o/dyld.h:181)
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:428: warning: 'NSAddressOfSymbol' is deprecated (declared at /usr/include/mach-o/dyld.h:188)
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c: In function 'TclpUnloadFile':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:493: warning: 'NSUnLinkModule' is deprecated (declared at /usr/include/mach-o/dyld.h:169)
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c: In function 'TclpLoadMemory':
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:697: warning: 'NSCreateObjectFileImageFromMemory' is deprecated (declared at /usr/include/mach-o/dyld.h:146)
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:730: warning: 'NSLinkModule' is deprecated (declared at /usr/include/mach-o/dyld.h:161)
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:732: warning: 'NSDestroyObjectFileImage' is deprecated (declared at /usr/include/mach-o/dyld.h:147)
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_tcl/work/tcl8.5.1/unix/../unix/tclLoadDyld.c:740: warning: 'NSLinkEditError' is deprecated (declared at /usr/include/mach-o/dyld.h:217)
make: *** [tclLoadDyld.o] Error 1

I searched the web and found suggestions to deactivate odcctools, but the problem in my case is that odcctools wasn’t even installed. So, instead what I did was temporarily move the arch.h file, rerun the install command, and it worked fine!

sudo mv /usr/local/include/mach-o/arch.h /usr/local/include/mach-o/arch.h.RENAMED

Leopard Broke SMB Tunnel Mounting via Finder

In Mac OS X 10.4 Tiger, you could use Finder (GUI) to mount an SMB mount which was being tunneled through ssh
For example:

  • From Terminal establish the tunnel:
    ssh -L 139:remote_machine:139 user@remote_machine
    
  • Then, in Finder, Go ? Connect to Server…
  • In “Server Address”, smb://localhost/mountpoint

However, this doesn’t work in Mac OS X 10.5 Leopard anymore!
The workaround is instead of using Finder, to use the mount_smbfs command in Terminal:

mount_smbfs //samba_user_name@localhost/samba_share /local/mount/point/

For example:
After establishing the tunnel (see above), I first made a mount point:

cd ~; mkdir sambamount

Then mounted it:

mount_smbfs //samba_user_name@localhost/data ~/sambamount

Once mounted, you should see the volume appear on your desktop, and you can drag it to the trash (or use ‘umount’) to unmount it.

**** UPDATE 25 Mar, 2009 ****

I’m getting many hits for this post, so I’m adding a little more detail for my setup specifically.

My work blocks almost all ports to incoming traffic. In order to log into a machine from the outside (for example from my home computer) I must first ssh into a firewall computer and setup a tunnel, or can ssh or telnet to another computer (you can do nothing on the firewall computer except ssh or telnet).

So, here’s my setup for tunnelling the SMB traffic within a ssh session (and still mount via Finder):

home <-ssh/tunnel-> firewall.example.com <-smb traffic-> smb_server.example.com

My work account credentials are the same on both the firewall computer and the SMB server.

You can add your modified version of the following to the file ‘/Users/mac_username/.ssh/config’:

#------------------------------------------------------
# For mounting smb shares locally from home:
#-- This is the name of this alias to this specific
#  configuration:
Host smb_tunnel_from_home

#-- Work's firewall computer (can also use IP number here)
Hostname firewall.example.com

#-- In place of 'work_username', your firewall username goes
#  here:
User work_username

#-- 127.0.0.2 is your computer, the second (where there are
#  x's) is the SMB server. Seems like I have to use the IP
#  number (instead of smb_server.example.com for this!):
LocalForward 127.0.0.2:139 xxx.xxx.xxx.xxx:139
LocalForward 127.0.0.2:445 xxx.xxx.xxx.xxx:445

#------ TO USE: ------
#--Using Terminal, at the prompt type (this creates an alias
#  of 127.0.0.1 at 127.0.0.2):
#    sudo ifconfig lo0 alias 127.0.0.2 up
#--Now start the ssh session:
#    sudo ssh work_username@smb_tunnel_from_home \
#    -F /Users/mac_username/.ssh/config
#--Then, in finder, Go->Connect to Server (Cmd-K), in the
#  box type:
#       smb://127.0.0.2/work_username
#--In the box which pops up, enter your work_username
#  and work_password.
#--Be sure to unmount the volume in finder when done using.
#------------------------------------------------------