I have a MacBook Air, 2009, with a recently replaced Apple battery in December 2012. Recently, when power cord comes off, the computer shuts down. Also, it usually will not restart unless power cord is attached.
The battery is dead.
The computer (in this case your MacBook Air) turns off because there is no more/not enough charge in the battery. If it's necessary to have the power adapter plugged in when trying to turn it on, it's a sure sign that the battery is discharged.
There are a number of utilities that you can get (paid and free) that will look at your battery status:
These are all good, but in my opinion, I would much rather use built in tools to get this info.
Using Terminal, just issue the command:
$ system_profiler SPPowerDataType
That will give you all the power settings related to your Mac. The output can be rather lengthy; the info you need will be at the top. You can limit it to just the battery info by tweaking the command as follows:
$ system_profiler SPPowerDataType | grep -i "charge information" -A 10
Charge Remaining (mAh): 3433
Fully Charged: Yes
Full Charge Capacity (mAh): 3517
Cycle Count: 941
Condition: Service Battery
Battery Installed: Yes
Amperage (mA): 0
Voltage (mV): 12343
Here we can see that the battery is in need of service. (Coincidentally, I have a MBP with the exact same symptoms you have, so the output here works perfectly!) The key here is that under "Amperage" we get a "0" which means there is literally no current coming from the battery (Note: even though it may have voltage, if there are no amps, it won't have the "power" to supply).
If we unplug the power adapter, the battery has nothing to supply so the computer shuts off.
You just need a new replacement battery battery (I suggest getting ones with at minimum a 12 month warranty; 18 month is better). From personal experience, the more "warranted" batteries lasted much longer. Definitely avoid the ones with less than a 12 month warranty no matter how inexpensive they are.
To replace the battery; it's actually very simple. Just remove the screws holding the back cover in place.
Then, just remove the screws holding in the battery and swap. Just be careful when disconnecting the battery from the logic board. Don't yank it off, use a spudger or similar tool to disconnect the molex connector by "wedging" it off.
Reverse the procedure to reassemble. Make sure you note where each screw comes from as they are different.
That's it. Your MBA will now be able to hold a charge like it did when new.
Your battery gets not charged properly. This can mean different things. Start inspecting all the different components involved.
Try resetting SMC first and only after a SMC reset did not solve your problem you should think about replacing your battery.
The other two answers already explain everything you need to know about each of those steps very well.
But you should also check all the components and connections your current passes through: power adapter, MagSafe connection pins, MagSafe connection at your laptop. If, for example your MagSafe connection is not stable, your SMC could get into trouble: are all the pins ok or is one stuck? This happened to a MacBook Pro we have and as a result we had to buy new Batteries continuously until we found out, that the pins apparently did not have a stable connection. A screwed up SMC could be at the cause of all your troubles and in that case the question is: why did it screw up?
In our case the MBP stopped holding charge and did not charge. A SMC reset + MagSafe cleaning helped in our case, but we will probably have to buy a new power adapter.
When your MagSafe connection works you should get proper feedback from the LED.
- check all the connections, what is the condition of your battery? Is it starting to increase its volume? Do you have a stable power connection at power outlet or at the MagSafe?
- do a SMC reset.
- try to charge after SMC reset
- does it charge? What does the MagSafe LED say: green, orange, off?
- in case SMC reset does not solve your problem you should consider a more thoroughly inspection of your battery.
From experience I can say that a screwed up SMC can put excessive stress on a battery and destroy it in a very short time.