Skip to content

Meh Blog!

Computer topics and random rants!

Archive

Category: Mac

I found a several articles explaining how to scroll an NSTextView to the end, but I didn’t find any that explained how to do it only if it was already at the end before new text was appended.

Consider this scenario.  You have an NSTextView scrolled to the end and as new text appears in the window, you want to see the new text immediately, so it scrolls to the very bottom for you.  Now you decide you want to read some text further up, so you scroll the text upwards.  As you’re reading, new text gets appended and suddenly it all scrolls down to the bottom again, causing you to lose your place.

continue reading…

I’ve been pulling my hair out for the last hour, while trying to copy files from my iMac to my Macbook Pro across my network.   continue reading…

Occasionally I need to edit system files that belong to root and I found that it can be quite annoying as I always end up using nano in the terminal as it doesn’t seem possible to elevate the privileges of an application from Finder.  For example if I wanted to edit my /etc/hosts file then usually I’d have to drop to a shell and type:

sudo nano /etc/hosts

The problem with that is that I have a nice looking graphical operating system here and although I love the fact that it uses unix under the bonnet, I really much prefer to edit my files in TextEdit rather than a console based application like nano.   continue reading…

I was trying to get wine working on my Mac.  It’s been erroring about something or another so I ran winedbg to see what it was complaining about.  The last function on the callstack seemed to be in the libcrypto.0.9.7.dylib library in the /usr/lib directory so in my infinite wisdom I renamed it to see if it was loading a different one from somewhere.  Big mistake…

I was left in a position where I could no longer sudo to rename it back.  I had no luck from Finder either and I couldn’t open new Terminal sessions.  I decided to reboot in safe mode by holding down shift while rebooting to see if I could repair the damage from there but my system just wouldn’t come up – I was left staring at the Apple logo.

In case you should ever find yourself in this position, don’t panic too much – After much panicking myself, I managed to fix it by doing the following.  Bear in mind at the time of writing I use Leopard so things may be a little different in future OS X versions.

  • Locate your OS X installation disk 1 and pop it in the DVD drive.
  • Reboot while holding the C key down to force your Mac to boot from the DVD drive.
  • It’ll load up and ask you what language you’d like to use.  Pick one (preferably one you can understand lol).
  • The next screen is all about reinstalling.  That’s a last resort really because we can fix things from here.  On the Utilities menu you should see Terminal.  Choose it and the Terminal will open with a bash shell.
  • Bear in mind that you’ve not booted from your hard disk so the directory structure will look different to what you’re used to.  Change directory in to /Volumes and then in to your hard disk, possibly called “Macintosh HD” unless you’ve changed it.
  • Now you’re actually looking at your hard disk and should be able to change directory in to usr/lib and mv the file back to it’s original name.  Just to clarify, you should not be in /usr/lib.  You should be in /Volumes/Macintosh HD/usr/lib.

Good luck!