Archive

Posts Tagged ‘osx’

Easy SSH Login

March 30th, 2017 No comments

Here is a simple way to setup key (password-less) login on Unix-like systems.

Once you’ve configured SSH locally, add your public key to remote hosts using the following command:

**NB** in the next line, be very careful to use cat >> (append) and not cat > (overwrite), or you will trash your remote authorized_keys2 file, leaving your remote inaccessible to everyone but you. Not cool.

cat ~/.ssh/id_rsa.pub | ssh remote_machine 'cat >> .ssh/authorized_keys2'

Replace .ssh/id_rsa.pub with your public key.

Also make sure remote folder ~/.ssh has mode 0700 and ~/.ssh/authorized_keys2 has 0600.

 

Categories: Linux Tags: , , , , ,

XCode and Older iOS Devices

January 16th, 2013 No comments

With a bit of hacking, it’s possible to target older iOS devices than those normally supported by the latest SDK:

https://stackoverflow.com/questions/7760946/is-it-possible-to-target-older-ios-versions-when-using-xcode-4-2-and-ios-5-sdk

Categories: Development, OS X Tags: , , , , , , , ,

/private/var/vm Disk Usage on OS X

January 16th, 2013 No comments

It seems this is filled with multiple (roughly) 1GB swap files, allocated as required.
Problem is they don’t go away (until reboot?).
One article suggested this:

sudo dynamic_pager -L 1073741824

Seemed to work: before running vm used 8GB, afterwards 4GB

Categories: OS X Tags: , , , ,

Growl 1.3+

January 16th, 2013 No comments

I like Growl notifications for automated builds (and not much else – does anyone really need more distractions from IM, Facebook, Twitter?).

As of version 1.3, Growl is only available through AppStore for $1.99, but the source is still available online. So if you happen to have XCode installed, the following instructions will get you running.

1) You need Mercurial to retrieve Growl source. To Install Mercurial: sudo easy_install pip && sudo pip install Mercurial

2) In a terminal window:

cd /tmp
hg clone https://code.google.com/p/growl/
cd growl
open Growl.xcodeproj

3) In XCode, disable code signing.

4) Back in terminal:

xcodebuild -project Growl.xcodeproj -target Growl.app -configuration Release
open build/Release

5) Copy Growl.app to your Applications folder.

More detailed, illustrated instructions available at: https://pragmactic-osxer.blogspot.com/2011/11/building-growl.html

Categories: OS X Tags: , , , , , , ,

Mountain Lion DNS Issues (and SMB)

December 9th, 2012 2 comments

I’ve been incredibly frustrated by how poorly DNS resolves since upgrading first to Lion, then later to Mountain Lion (on a new machine, but migrating my old files). The impact of this was particularly bad connecting to SMB/CIFS/Samba shares – some would mount after several minutes, others not at all.

Early on it became clear the problems were related to my router (DDWRT) not supporting IPv6 but then neither does my ISP. Here are a few things to try:

DNS Resolver Order

Normally /etc/hosts is first in line for DNS resolution. But it seems improper line termination, presumably a carriage return/linefeed instead of just a linefeed, causes all sorts of problems. Many posts describe ways to force reloading of the hosts file, but the root cause seems to be improper line termination. Always make sure you use a Unix compatible editor.

To check the order resolvers are called:

scutil --dns

/etc/hosts Entries

These two were the main source of my problems:

1. My host has multiple names – these must all be present, and fully qualified:

127.0.0.1 hosta hosta.foo.com
127.0.0.1 hostb hostb.foo.com

2. All localhost entries must have ::1 entries too, or OS X will send IPv6 requests to resolve them externally. And this despite IPv6 being disabled on the interface!

::1 hosta hosta.foo.com
::1 hostb hostb.foo.com

Turn off IPv6 in Network Preferences

Go to System Preferences -> Network -> Advanced -> TCP. In the Configure IPv6 list, you may have an “Off” option. If so, select it. If not, see next tip.

Turn off IPv6 from Terminal

List available network services:

networksetup -listallnetworkservices

Turn off IPv6 on chosen device (name from above list):

networksetup -setv6off your_device_name (i.e. Wi-Fi, Ethernet)

Now the Configure IPv6 list  for that device will show “Off”  (see previous tip).

MobileMe Remnants

Apparently older OS X installations migrated to newer releases may still have hooks to no-longer existant MobileMe servers. Many users report that removing these greatly speeds up SMB connection. The following removes those references if present and are harmless if not.

defaults delete -g iToolsMemberDomain
defaults delete -g iToolsMember

 

Categories: Network, OS X Tags: , , , , , , , , , , , ,

Headless Parallels

November 12th, 2012 No comments

Generally I like to run servers headless, as in with no display or console. In Parallels this is a little tricky, but doable from Terminal. However, Parallels Desktop must not be running. If you do launch Parallels while a Terminal-spawned VM is running, a console will automatically be created.

To see a list of available VM:

prlctl list -a

To launch a VM:

prlctl start vm_name

Timemachine Problems – fix summary

November 4th, 2012 No comments

Continuing from my Timemachine post, here is my summary of instructions from Garth Gillespie’s site (garth.org).

In Terminal:

sudo su - 

The verication that has already run has marked your sparsebundle as bad, so first we need to make it look normal:

chflags -R nouchg /Volumes/{name of your network share}/{name of}.sparsebundle

This may take a little while. Then:

hdiutil attach -nomount -noverify -noautofsck /Volumes/{name of your network share/{name of}.sparsebundle 

You will then see something like

/dev/diskx Apple_partition_scheme /dev/diskxs1 Apple_partition_map /dev/diskxs2 Apple_HFSX 

Where x is the disk id for the external disk. You are interested in the one labeled Apple_HFSX or Apple_HFS. It might be 2, 3, 4 or higher.

At this point, the filesystem check is running. To see what’s going on, tail the fsck_hfs.log

tail -f /var/log/fsck_hfs.log 

Normally, if fsck is running, it will successfully repair the sparsebundle, but it can take a long time (hours). Grab a coffee.

When done, you should see:

The Volume was repaired successfully

So far, this has always worked for me. But if you get:

The Volume could not be repaired
 You can try:
fsck_hfs -drfy /dev/diskxs2 

Make sure to replace x with whatever number your disk is from the output above. Like before, use tail to follow the fsck log output, and get comfy.

Once fsck has completed successfully, unmount the volume:

hdiutil detach /dev/diskxs2 

Lastly, you need to clean up your backup’s state by editing com.apple.TimeMachine.MachineID.plist (top level of your sparsebundle) as follows:

1) Remove these two nodes:

<key>RecoveryBackupDeclinedDate</key> <date>{whatever-the-date}</date> 

2) Replace:

<key>VerificationState</key>
<integer>2</integer>

with:

<key>VerificationState</key> <integer>0</integer> 

And you should be good to go!

Categories: OS X Tags: , , , , ,

Mountain Lion Timemachine Problems

October 15th, 2012 No comments

From the Apple discussion groups, drm31078 says:

Received another reply from synology pointing to Lion as the problem…

Here is what I received from my engineers.

This problem seems to have happened since OSX 10.7.
We use the open source – netatalk to support AFP and
it summarized that this problem also exists on Apple Time Capsule too.
(https://www.netafp.com/tn005-10-7-lion-time-machine-and-netatalkafp-620/
https://discussions.apple.com/message/17441528#17441528 )

For the Macs that doesn’t trigger “Start New Backup” YET,
users may use the following method to try and fix the verification flag and avoid wiping out all old backup history.
https://www.garth.org/archives/2011,08,27,169,fix-time-machine-sparsebundle-nas-b ased-backup-errors.html
https://pondini.org/TM/C13.html

Hey Apple are you seeing this?!?!