Tag Archives: Mac

Death of the Mac: The smoking gun

Some people are still convinced that OS X being jailed by default is not a sign of evil intent on Apple’s part. So here’s some more commentary around the topic.

“If Apple really wanted to restrict all app distribution to the app store, why did they come up with this Gatekeeper system?”

Because right now, there are a lot of applications that can’t be placed on the App Store because of Apple’s rules, as well as the technical restrictions such as sandboxing. There are even more applications whose authors are not interested in the App Store. I think the App Store has failed to get the critical mass Apple hoped for.

The ‘third way’ approach of “Well, you can get a key and sign your code but not actually have to use the App Store” is a way to entice everyone to sign their code with Apple-approved keys. Once all the major developers go along with that, the “Turn off Gatekeeper” option can be removed from OS X without 99% of users ever noticing.

At that point, Apple has complete control. They can set the terms for what software is allowed on the Mac, and yank apps even if they aren’t from the App Store. If they don’t want DVD rippers or emulators available, they just revoke the appropriate developer signing keys. And they can rent you developer access to your own hardware, like they do with the iPad and iPhone.

“You’re paranoid. Apple would never do that.”

If you don’t think Apple would ever do all these things, I have to ask: Why wouldn’t they? It would give them complete control over the platform, and the iPhone and iPad have apparently demonstrated that there would be no impact on sales from doing so. Even big names like Adobe and Microsoft have gone along with the iPad’s restrictions.

Compulsory signing would also eliminate the ability to run cracked pirated versions of applications. Developers would love that—and so would Apple, since they could start demanding a 30% cut.

You can see more of this cat-herding going on if you look at the new features in Lion and Mountain Lion. iCloud is only available to applications in the Mac App Store. The new notification center is the same. There’s really no technical reason for such restrictions; it’s just Apple using new functionality as a carrot to get everyone onto the App Store where they can be controlled.

“It’s just being done for the sake of security.”

You could just about make the argument that iSync needed to be limited for security reasons, but there’s no such excuse for apparent limitations on notification center access. To me, this is the smoking gun that shows Apple’s intent.

If Apple were really concerned with security, they’d be updating the out-of-date GPL software that ships with OS X to current versions that have had the security holes patched. But instead, they are purging all the GPL v3 licensed software.

The two big features of GPL v3 are disallowing use of patent lawsuits to prevent people using the code you distribute, and preventing locking down hardware so you can’t run modified code. The idea that Apple wants to be able to sue people who run GCC or the bash shell is possible, but it seems unlikely to me. Similarly, wanting to share code between iOS and OS X doesn’t really explain why they won’t distribute things like the bash shell and GCC which only exist in OS X. So that leaves locking down OS X as the most plausible motivation.

If Gatekeeper is all about security and not about control, why don’t Apple offer the same options as Gatekeeper on the iPad and/or iPhone? If Apple do that, I’ll admit I’m being paranoid and shut up about this. (And buy an iPad.) Since I submitted a request for a developer option to turn off the jail when the iPhone was launched, I’m not holding my breath.

On the contrary, unless Apple reverses their current course and opens up the new OS X functionality to all applications and not just jailed ones they get a 30% cut from, my current Mac will be my last.

Macintosh RIP: 1984–2012

OS X is now no longer Mac OS X. The Mac is dead.

Meanwhile, the next release of OS X will, by default, refuse to allow unsigned code to run. As I predicted, Lion was the last unlocked OS X, and OS X Mountain Lion ships jailed, like iOS. And good luck selling your software if it requires turning off the ‘security’ of GateKeeper; never mind that the OS X malware threat is practically nonexistent.

For now Apple gives you a way to jailbreak your Mac for free, but I expect that option to disappear with the next release. You’ll pay an annual developer fee and submit your code-signing keys to Apple, and in return you’ll get shell access and the ability to run your own code on your own computer. It’ll be just like iPhone and iPad, where you pay $99 a year to be able to run your own code on ‘your’ device.

And as people on Google+ have pointed out, it won’t be long before the corporate interests start politely asking Apple to revoke developer keys.

That emulator you like playing games on? Oh, sorry, Nintendo and Atari asked Apple and they disabled it. Your copy of VLC? Oh, sorry, the MAFIAA threatened Apple with a lawsuit for enabling playback of pirate movies, so it was disabled. Your DVD ripping software? What, you need to ask?

So I guess I’m moving to Linux. I’m sure there will still be people content to live in denial about how this is going to go, but I’m not one of them.

I started using the Mac in 1986. Bought my first Mac in 1990. So I’d just like to repeat a big ‘fuck you’ to all the lemmings who bought locked-down iPhones and iPads, and convinced Apple they could get away with this.

Did the Mac just die?

Months ago, I outlined what I considered a nightmare scenario: that Apple would gradually lock down OS X to be like iOS, with Apple exercising absolute control over what software you were allowed to run, and requiring that software be developed in Objective-C, like on the iPhone and iPad.

Yesterday, it started to happen. Apple announced the App Store for the Mac. Just as with the iPhone, there’s now an annual fee to be a Mac developer for the store, and a long list of things your software is not allowed to do. For example, you’re not allowed to ship software that looks too similar to Apple’s software, or duplicates its functionality. Want to write a Finder replacement or iTunes alternative, or perhaps a web browser? Bad luck, Apple may prevent your software from being shipped via the App Store.

You’re also not allowed to use third party installers. You’re not allowed emulators. You’re not allowed copy protection, you’re not allowed to present a license screen, you’re not allowed to leave shortcuts on the desktop, you’re not allowed to mention that your app is available for Windows or syncs with Android, you’re not allowed to do software rental.

“We never said that 2010 wouldn’t be like 1984.”

Of course, Steve Jobs was quick to point out that there are still going to be alternatives to the App Store for distributing your software.

For now.

But a chance comment on Macintouch made me think: Lion is the last big cat. Could OS X Lion also be the last planned unlocked OS X? Steve Jobs talked about the “virtuous circle” of iOS feeding back into the Mac–could the Macs of 2012 ship with iOS, with a proper unlocked OS X reserved for developers, and priced to match?

I was trying to convince myself that I was reading too much into it all, and then the next clue surfaced today: Apple deprecated the JVM. They are no longer interested in assisting users in running Java applications on their Macs, and warn that there may be no JVM in OS X Lion, let alone a JDK. If you’re a Java developer using a Mac, it’s time to start migrating, unless you want to count on Oracle releasing a JDK for the Mac before Lion ships. And that’s unlikely, because it would be an immense amount of work for them.

In addition, the App Store rules say no Java apps are allowed. The new MacBook Air ships with no Flash plugin, and Safari will no longer prompt you to install it if you visit a page that uses Flash. Other Macs will be following suit.

So here we go. The Mac is turning into a big iPad. Thanks, all you lemmings who bought crippled iPhones and iPads, you’ve convinced Apple that it can get away with crippling the Mac as well. So after 23 years of using Apple computers, my current Mac looks like it could be my last. I’m not the only person seeing lockdown in the Mac’s future either.

I’m going to hold out for a little longer and see what happens. So far OS X Lion doesn’t offer anything I want, but maybe there will be something worthwhile announced before it ships. Maybe Mac users or developers won’t accept the App Store. Maybe.

But I’m suddenly very wary of investing in any new Mac software, when I could be switching platform in a year. And I’m looking at the state of video editing on Linux, because I really don’t want to go anywhere near Windows.

Update: It’s reported that Steve Jobs has dismissed the idea of a Mac app store with mandatory Apple approval. Which is great, but I’m sure he can change his mind, and it doesn’t stop OS X being removed from low-end machines and replaced with iOS as I’ve suggested.

The computer for the rest of them

MacWorld has an article about the sense of disappointment and betrayal many of the old “Mac faithful” feel at Apple these days. I think it’s a bit brief and could use some expanding on.

The Apple II was an open machine. Open architecture, anyone could program it.

Steve Jobs wanted the Mac to be a closed appliance, but the hardware was quickly opened up as well as the software. The Mac really started to catch on once development environments like HyperCard allowed everyone to develop their own software, for free, and distribute it to anyone they liked. I literally bought a Mac so I could have HyperCard.

The Mac OS was built on open standards. Everything was documented, from the QuickTime file format to the windowing APIs. Anyone could get the documentation, with no legalese to agree to. Anyone could develop software and sell it for as little or as much as they wanted, anywhere they wanted, and they could give away the source code if they wanted.

Steve Jobs killed all that with the iPhone and iPad. For many of us it has seemed like a betrayal. During the dark days of the 90s, when the Mac almost died, it was the shareware and freeware programmers that stuck with the platform and kept it alive while companies like Adobe killed most of their products and told people to switch to Windows. Now it’s the small developers that Apple is screwing with fees, legalese and arbitrary app store bannings. If you’re a big corporation, the rules don’t apply, and you can have all the nudity and overlapping functionality you like.

It all makes the “1984″ and “Think Different” ad campaigns look like a sick joke.

Even as recently as the iPod, there was openness. You could put content on from any place you liked. Now the only place to get apps for your iPhone is the app store. Imagine how well the iPod would have succeeded if the only place to get music for it had been the iTunes store.

The hardware has lost its way too. I love good design, but form has to follow function, not the other way around. Steve Jobs is apparently obsessed with making everything thin, even if it means laptops where you can’t change the battery and the CPU overheats if you push it too hard encoding DVDs. Even if it means phones made of glass and metal that shatter on impact after a 1m drop.

So after 20 years of buying only Apple computer hardware, I have an Android phone, which I love. Once my MacBook Pro dies, I’ll probably build a hackintosh, because I don’t want a laptop where I can’t change the battery.

Sure, Apple doesn’t owe me anything. I’m sure they’ll survive selling to stockholm syndrome fanboys and people who have to have the thinnest shiniest gadget. But still, it feels like I’ve lost a friend. I miss the excitement of wondering what would be announced at the next Apple event; now I know it’ll just be more locked down iOS crap I have no interest in.

As for the argument that if Apple hadn’t become closed and proprietary in order to survive, I’d be running Windows 7… well, if OS X goes down the same route as iOS, I’ll be running Linux anyway. You don’t save something by destroying it, and the open and creative hacker culture was what made the Mac interesting. Maybe it was an illusion, but it’s hard to accept that Apple really is as bad as the PC fanboys always claimed.

Reflections on a Macless month

On December 23rd, my MacBook Pro died. The screen started flickering, and the entire graphical layer died. The underlying Unix system was still responsive, and I could SSH in, but that was it. Rebooting the machine, it would run for a while, then die with the same fault.

I used rsync to create a full backup–I already had a Time Machine backup, but better safe than sorry. After a couple more reboot cycles it stopped booting entirely.

I took the machine to the Apple Store. Based on the problem description and my apparent cluefulness, they said they’d need to get a replacement motherboard. Unfortunately, motherboards for my particular model of MacBook Pro are apparently in short supply, so I’d have to wait.

I took the machine home. Christmas came and went. In the new year, I got a call from the Apple Store. The replacement motherboard was in. They warned that they could only reserve it for me for 6 days. I said that wasn’t a problem, and was at the store half an hour later to drop off the machine.

The next day I got a call. Swapping the motherboard hadn’t fixed the problem. The machine needed to be sent to the main Apple service center. Make it so, I said, confirming that I had a full backup.

The service center received the machine…and put the repair on hold, because they needed another part that was in short supply. And so I waited, without a Mac, using Linux for all my computing needs.

Yesterday the service center flipped the status on my Mac to repaired, pending return shipment. Just now, it arrived back in my hands by overnight shipment.

The accompanying paperwork says that they replaced the motherboard, the display, the cooling fan, the DVD-RW drive, and some internal cabling. Basically, I have the original casing, hard drive and keyboard, and the rest is new. So once again, the extra cost of 3 years of AppleCare has proven to be an excellent move, this time saving me from having to drop $1500+ on a new machine.

I’ve had similar experiences with IBM (and Lenovo) laptop hardware. Always buy the extended warranty for a laptop. Consumer Reports agrees. It’s not like I’m rough on my hardware–I travel infrequently, I’ve never dropped a laptop, and I’ve never spilt coffee in one either. It’s just that laptop hardware is inherently less reliable than desktop hardware–you have smaller components, and more heat-producing hardware in a tighter space. My Mac probably died when it did because I’d just been encoding and burning four different DVD projects.

So, what was it like using only Linux instead of Mac and Linux for almost an entire month?

On the whole, not bad. Linux does the job for most day-to-day tasks. The two places where it still falls down are sound and video.

Ubuntu 9.10 has seen major regressions in sound functionality–any kind of Flash audio frequently results in fragmented looping, like a CD skipping. Applications also tend to grab the sound interface and not let go, preventing anything else from playing sound until you quit them. The user interface for volume control is a total disaster too, and Bluetooth headsets don’t work.

In video land, there just isn’t anything to compare with iMovie HD plus iDVD. OpenShot looks promising for the editing piece, but it’s still very young.

There are quite a few other Mac apps I missed. iTunes doesn’t really have a good equivalent, functionality-wise. Organizer software on Linux isn’t as advanced. But if you don’t use sound for anything more than soundtracks to video, and don’t do much video editing, then Linux is probably good enough. It’ll certainly cope with web browsing and office documents.

Would I switch? Well, if you ever need to jailbreak a Mac, that’s the day I switch. Failing that, I suspect Apple can keep far enough ahead of Linux that switching won’t be a temptation.

Widget for calculating hours

Rothko runs a coffee shop. Each week she needs to calculate how many hours each employee worked, given their clock-in and clock-out times. It turns out that this is a surprisingly painful task to perform using regular tools like calculators or spreadsheets. I built a Mac dashboard widget to make it easier . I’m putting it up for download because I can imagine other people might find it useful. (For example, anyone who has to fill out paper timesheets.)

To use it, enter times in the "start" and "end" fields for each day. You can use 12 or 24 hour clock. For 12 hour clock, if there’s an "a" in the field it’s a.m., if there’s a "p" it’s p.m. You only need to type the colon and number of minutes if there’s an actual number of minutes involved. (It’s all about reducing the number of keystrokes.)

Tab takes you on to the next field as usual, and automatically recalculates everything like a spreadsheet. The individual durations worked for each day are shown, and totaled into a final figure in hours and minutes at the bottom.

So for a standard work day, you’d type 9a [tab] 5p [tab] and it would enter 9:00 am start, 5:00 pm finish, calculate the duration as 8:00, and add it to the total.

The only other control is the Reset button, which blanks out the fields ready for the next calculation. Quick, simple, efficient, and hopefully correct…

BlackBerry Curve review

In mid November, our contract with AT&T (formerly Cingular) expired. We switched to T-Mobile and got BlackBerry Curve phones.

I was a BlackBerry skeptic for a long time. I didn’t think I wanted a phone with a full QWERTY keyboard. This changed when we looked at the phones available. It turned out that the Curve was only marginally wider than the average phone, perhaps a centimeter or so. It’s otherwise comparable to mid-range phones in size. It ends up being pretty much as portable as our Sony Ericsson Z520a phones.

The BlackBerry UI is best described as “retro”. The icons look like 1990s Windows, the text fonts look like 1980s Atari ST, and the general method of navigation most resembles Palm OS. This is both a good thing and a bad thing. Starting with the good, the UI is clearly designed from first principles to work well on a handheld device. The central trackball handles scrolling, pointing and clicking. It sits easily and naturally under the thumb. You can do pretty much everything with one hand, including browsing the web and checking e-mail.

This is in marked contrast to the iPhone, which pretty much requires two-handed operation. Windows Mobile devices suffer from having a desktop UI squeezed into a handheld form factor, and also require two hands, and often a stylus. Symbian is designed for phones, but the UIQ interface for smartphones uses a stylus. Overall, then, the BlackBerry works better than other phones I’ve tried when you’re standing in an airport with a coffee in one hand.

On the downside, it’s hard to find the icon you want in a hurry, because of their visual clutter. Perhaps a replacement UI theme would help; I’m a little tempted to grab the theme designer and start working on one, but it’s Windows only. The fonts were initially problematic too; nowhere near as nice as Apple’s, and they took some getting used to.

But when it comes time to reply to an e-mail, niggling issues with fonts were forgotten as I got to grips with the keyboard. Yes, it requires both hands, or more accurately both thumbs. It’s not as fast as a full size keyboard, but it’s faster than Palm Graffiti or Windows Mobile pen input, and much faster and less frustratingly error-prone than I found the iPhone’s on-screen keyboard to be. Unless Steve relents and allows a Son of Newton to use the Newton’s non-cursive text recognition, I can’t see it being bettered.

Textual messaging is where the BlackBerry really shines. It’s quite possible to thumb out fairly lengthy e-mail responses, or even update your web site. As far as IM, there’s support for Google Talk and AIM built in, as well as Yahoo Messenger, Windows Live Messenger and ICQ if you know anyone who still uses only those. There are third party clients for non-Google Jabber and other protocols, and in addition, there’s BlackBerry’s own BlackBerry Messenger, previously called PIN messaging.

If you have a friend who also has a BlackBerry, PIN messaging is definitely the way to go. The manual doesn’t cover its benefits, so I’ll digress a little here. Unlike other IM systems, PIN messaging is tied to the BlackBerry device by a unique ID. You connect with another person initially by sending them an invite via their BlackBerry-specific e-mail address, or any other address they access via BlackBerry e-mail. When they reply, their device records the device ID you sent, and sends you theirs.

The primary benefit of PIN messaging is that it’s push-based. The recipient doesn’t need to be logged in. If their phone is switched off, the message will be queued until they log on.

The second benefit of PIN messaging is that it’s reliable. Unlike SMS, messages don’t get randomly dropped. In addition, you get delivery confirmation automatically for every message: when you hit enter, the line you typed appears in the transcript with a small icon next to it indicating that the message is going out over the network. When your device receives positive confirmation that the recipient’s device has displayed the line you sent, the icon changes.

If that’s not enough, there’s a third benefit over IM or SMS: there’s a separate “ping” option. So you can set up your regular notification to be something discreet, and know that your spouse can ping you to set off something more noticeable if necessary.

Other than that, PIN messaging has the usual file transfer, allows you to send voice memos, and looks and behaves like regular IM. For us, it has completely replaced SMS, not least because it doesn’t cost 15¢ a message.

One interesting feature of the BlackBerry is that as well as individual icons for each messaging system, there’s also a unified inbox that shows IM, SMS and e-mail in one place. This makes sense, as they all have pretty much the same UI on the Curve; the protocol is almost an irrelevant detail. I believe that if you attempt to send pictures via SMS, the phone automatically uses MMS, but I haven’t tried it.

Web browsing is a mixed bag. The built in BlackBerry browser has two modes, mobile mode and “desktop” mode. Although there are references to WAP, the browser copes with both, the mode just determines how the page is formatted for display. In mobile mode it works like a typical phone browser, in desktop mode it tries to deal with things like tables, CSS and JavaScript. Overall it makes for a pretty good browsing experience, as phones go. (If you haven’t tried browsing from a phone, the main issue isn’t usually layout–it’s latency. Each page request takes a ridiculously long time to send, compared to a desktop system. I assume this is something to do with the mobile network.)

An alternative is Opera Mini, which takes the “thumbnail of page with moveable active area” approach to web browsing. It works surprisingly well with sites that the built-in browser can’t cope with, like zagat.com. (Yeah, good move, make a web site of restaurant reviews that doesn’t work with a phone browser.)

Maps are another strong point. There’s a map application supplied, but I downloaded Google Maps for BlackBerry, which is free and offers pseudo-GPS location by correlating your active cell to its geographical location. Accuracy can be as little as 50m or so in cities, up to 1km in the countryside. The Google Mail application also works well once downloaded.

The BlackBerry OS appears to be Java based, and is pretty solid. It’s more reliable than a Palm; I’ve only managed to crash it once, which is comparable to Linux on the N800 in solidity. Initial bootup (after inserting a battery) is horrendously slow, but once running it seems to use a soft power off which doesn’t require a full boot. The UI is generally responsive at all times, unlike some Sony Ericsson phones. You can put the phone into standby mode by holding down the power switch. In standby the screen and keyboard deactivate, but you can still receive messages and calls. The same hold-down-button action brings the phone out of standby instantly.

The one bug I’ve found so far is in the BlackBerry web browser. After a while the cache gets full and slows browsing down tremendously. The workaround is to empty the cache once a week.

The phone shows a lot of attention to the details of how a mobile device should best operate. For example, an ambient light sensor behind the notification LED turns the screen brightness down in dark areas, and automatically turns on the keyboard backlight. The LED itself has behavior customizable through the notification options; each event (phone call, IM, SMS) can have any or all of a user-chosen sound, vibration, and LED flashes. You can even set different messaging systems to have different notification; for example, I have IM just flash the LED a few times, unless it’s a PIN message from the spouse.

Mac sync is a bit of a sore point. There’s a package called PocketMac that BlackBerry purchased and now give away for free. It worked for me, more or less, but had some annoying bugs. (For example, syncing with a subset of address book records didn’t work, and editing records on the BlackBerry resulted in duplicates.) The solution is simple enough: Mark/Space have a Missing Sync for BlackBerry, which makes everything work, and even syncs user pictures so you can see the face of the person calling you if you’ve given them a picture in OS X.

Overall, it’s the best mobile phone I’ve used. Whether it’s good for you will of course depend on your use cases. If you’re someone who likes to talk to people or use voicemail rather than IM or e-mail, or if you have little patience for customizing software, the iPhone is probably a better bet. It certainly look prettier. But if you prefer text to voice and prefer functionality to prettiness, the Curve beats the iPhone hands down. This may change once they stop crippling the iPhone and open it up to third party applications; we’ll see. For now, I’d pick the Curve again, even if the iPhone wasn’t tied to AT&T.

Update: Oh yeah, the Curve is also a quad band phone. That’s de rigeur, so I didn’t even think it was worth mentioning.

Cleaning up bash customizations

One of the things I found confusing about bash was its startup scripts: there were so many of them. Eventually I snapped and sat down with a terminal and the man pages, and worked out how it actually behaves. Here’s a summary.

Interactive
login
Interactive
non-login
Non-interactive Remote shell
/etc/profile A      
/etc/bash.bashrc   A†    
~/.bashrc   B   A
~/.bash_profile B2      
~/.bash_login B3      
~/.profile B4      
~/.bash_logout C      
BASH_ENV     A  

On startup, bash executes any script labeled A in the table above, followed by the first script B it finds. On exit, it executes any script labeled C above.

Let’s look at the column headings in a little more detail.

  • An interactive login shell is a shell that you are typing into, that is the first such shell you execute on the machine. Typically you will have had to log in immediately before the shell starts. For example, when you SSH to a remote system and type commands to that system, you are typing into an interactive login shell.
  • An interactive non-login shell is a new shell started once you have already logged in; one which doesn’t require that you log in again.For example, if you open a new terminal window in your graphical user interface and get a shell prompt, that’s an interactive non-login shell. Another example of an interactive non-login shell would be a sub-shell started from inside a text editor; for example, typing :sh in vi.
  • A non-interactive shell is a shell which doesn’t prompt you; it just runs a program and then exits. The most common example of this is any program written in shell script, such as a configure script, a startup script in /etc/init.d, or any other file marked as executable that has #!/bin/bash on the first line.
  • A remote shell is a shell started by a program such as SSH or rsh in order to run a command on a remote machine.For example, the rsync and scp commands use SSH remote shells in order to copy files between machines.

So looking at the second column, an interactive login shell will execute /etc/profile always. It then looks for ~/.bash_profile, ~/.bash_login, and ~/.profile in turn, and executes the first of those it finds. On logout, it executes ~/.bash_logout.

The /etc/bash.bashrc A† item is special; whether bash searches for it is dependent on a compile-time option.

BASH_ENV is an environment variable which allows you to make non-interactive non-login shells (such as shell scripts) execute a startup script. Set BASH_ENV to the filename of a script and then invoke a sub-shell, and the script will be executed when the sub-shell starts up.

Problems with bash’s behavior

Given the above table, the short summary is:

  • If you want something executed only when you first log in, put it in ~/.bash_profile
  • If you want something executed only for additional shells (such as OS X terminal windows and xterms), put it in ~/.bashrc

But there are a couple of problems with this arrangement, problems which suggest that bash’s startup behavior wasn’t really thought out with users in mind.

Firstly, if you are anything like me, most of the things you want to put in shell startup scripts are things you always want executed. Command aliases, for example; or environment variables that tell pieces of software where to find their bits (JAVA_HOME, ECLIPSE_HOME).

You could put those in both .bashrc and .bash_login, but that represents a maintenance problem: if you change something, you have to remember to change it in both places. So, you might set up a third file for global stuff, and use the shell command source to read it in from both .bashrc and .bash_login. I’ve seen some Linux distributions set this up as the default. I don’t like it, however, because it means you now have 3 different startup files floating around, and when you want to change something you have to remember which file it’s in (or sit and work it out).

The second issue with bash startup scripts is that the distinction between login shell and non-login shell isn’t a very useful one these days. Most of us use graphical user interfaces, so we never see a login shell on the machine we’re using. (For example, any terminal window you open on OS X is a non-login one.) Even when I use SSH to shell into a remote system, I don’t generally want that first login to behave differently to any other shell I start (such as shells inside screen).

What I do care about, on the other hand, is whether the shell is interactive. I don’t want my reminder program printing stuff when rsync is trying to connect and transfer files. I don’t want all my custom commands and aliases getting in the way when running scripts to configure or build software. And I don’t want to slow things down loading cdargs unless I’m actually going to be maneuvering around the directory structure by typing.

So what I want is to have a single customization script, and be able to split it into stuff that is always run, and stuff that is only run when I’m using the shell session interactively. Here’s how to do that.

Simple all-purpose bash initialization script

Start off by moving all your current bash startup scripts into a temporary directory, so you have a clean slate. Then, create a skeleton ~/.bashrc that looks like this:

### Start of universal section ###
# Commands in this section will be executed by both interactive and
# non-interactive shells.
# Commands here must produce no output, or they will break commands
# like scp and rsync.

### End of universal section ###
[ -z "$PS1" ] && return
### Start of interactive section ###
# Commands in this section will be executed only by interactive shells.

### End of interactive section ###

Next, cd ~ if you’re not already in your home directory, then ln -s .bashrc .bash_login

Now you have a single customization file for all your shell sessions, called ~/.bashrc. You can copy in each command from your old customization files, placing them in the appropriate section according to whether you need them all the time, or just in shells that you’re typing in to.

If you really care about login shells

If for some reason you do want to have login shells behave differently from non-login, that’s pretty simple too. Instead of the ln -s command above, create the following ~/.bash_login file:

if [ -f ~/.bashrc ]; then
  source ~/.bashrc
fi
# Commands for login shells only go under here

Now you have two places customization commands may be placed, but you get the option of having login-specific stuff.

Dealing with multiple systems

Another trick I use is to examine the host name of the machine. This lets me use the same .bashrc everywhere; my Mac’s .bashrc is the same as the one I use on my Linux box and the System z mainframe at work. Here’s the code:

if [ "$HOSTNAME" = "T41p" ]; then
  # Customizations specific to the ThinkPad laptop go in here
fi

You can use code like this in either the interactive or non-interactive section of the .bashrc above.

Oh no, more Apple drama

It wasn’t much fun following Apple during the 90s. The transition from mono to color was painful, as it involved whole new chunks of OS and a different processor. The transition from Motorola 680×0 to PowerPC was also ugly and painful, and a lot of software simply stopped working and was never fixed. Those of us who had 680×0-based Macs quickly found them made forcibly obsolete long before they would normally have become unusable. Then came OS X, and a bunch more machines were forcibly obsoleted, more software broke, and more developers gave up.

Things have been looking pretty good in the Apple world recently, though. The technically adept have been flocking to switch to the Mac, the OS keeps getting faster and better rather than bigger and flakier, and open source and Java software now runs better on OS X than on Windows.

And now, here we go again. Except that this time, it’s going to be much worse. Whereas PowerPC processors were able to emulate 680×0 at acceptable speed, it’s going to be a lot tougher to try and emulate a 3GHz PowerPC G5 on any kind of Intel chip, even the kind shipping next year. Everyone who uses Metrowerks CodeWarrior for their Mac development (i.e. all those big old legacy Carbon applications from the 68K days) is going to be out of luck, as they’ll first have to drag their entire codebase over to Xcode, and then spend weeks (according to Jobs) fixing up the code. So one thing’s for sure–we’ll be waiting years for another release of Quark XPress this time, too.

The core problem is that the x86 is a lot less like the PowerPC than the PowerPC is like the 680×0. For starters, the x86 stores all its numbers half backwards and half forwards–the least significant bytes are stored first, but within a byte the most significant bits are stored first. (That kind of ugliness is fairly typical of Intel designs, which are legendarily unpleasant to program for at low level.) Any program that does bit or byte manipulation is likely to break. The PowerPC also has a lot more registers than the x86, which means that emulation is tough.

Ultimately, though, the fact that the x86 is a hideously ugly design doesn’t matter too much, because hardly anyone touches machine code these days.

Still, will Apple be able to pull off this kind of screwing around with their developer and user communities again? I don’t know. The more interesting question is why they are willing to risk it. With Nintendo, Sony and Microsoft all using PowerPC cores in their next-generation console systems, it really seems like a strange time to switch to Intel CPUs. Plus, if you want an x86 with PC-crushing performance and price, why not choose AMD rather than Intel?

One possible reason is that Apple is strongest in laptops, and IBM has singularly failed to deliver a G5 that can be stuck inside a laptop. AMD isn’t all that in laptops either, which would explain why Intel. But then again, there’s no reason why laptops can’t continue to use the G4, save for the perception that the G4 is “obsolete”, a perception which Apple itself has to take the blame for. Jobs says that there are no plans for improvements to PowerPC for the next few years. I don’t know whether that’s true or not; we’ll see.

Then there’s the intriguing possibility that Apple would like users to be able to run WINE. On the one hand, people could then switch to a Mac and still run their Windows software on it, for free. On the other hand, who would bother to develop Mac software if everyone could run Windows software? One possible answer might be to bring back Yellow Box for x86, which allowed Cocoa (NeXTStep) software to run on Windows. Still, even without WINE, software developers might just say “Hey, you want to run our software on your Mac? Just dual-boot into Windows!” (Jobs has already said that they’re not going to do anything to stop people running Windows on the Mac.)

So WINE on the Mac and Intel CPUs in the Mac could either be a colossal disaster that will kill the platform, or the best thing to ever happen to the Mac. I’m not going to pretend I know which is the case. I do know one thing, though: I’m sure as hell not going to buy a new Mac now, and I had been hoping to upgrade some time during the next year. No, I’m going to sit quiet and see what happens. I’ll want to see all my core applications available in native x86 versions, and an x86 based Mac that blows the doors off the G5, before I spend more money on Apple hardware. And as with the last round of turmoil (the switch to OS X), if it all goes disastrously wrong I’ll just switch to Linux everywhere.