To replace an air conditioner compressor, turn it off, remove the refrigerant, cut the copper lines running to and from it, remove the base unit, mount the new compressor and reinstall everything. Replace the filter-drier for the refrigerant, then run dry nitrogen through the system. Seal and vacuum the system.
Recover the refrigerant from the system using a recovery unit, then transfer it to a storage cylinder. This is required by law due to regulations of the U.S. Environmental Protection Agency. Mark the placement of the leads before disconnecting them from the compressor's terminals. After cutting the copper lines, remove the mounting bolts holding the compressor in place and reuse them when you install the new compressor. Reconnect the copper lines before purging the system with the dry nitrogen, and pressurize the system with dry nitrogen again after everything is installed and sealed.
Check for leaks and correct any that occur. Connect a vacuum pump to the system and allow it to run for several hours while the general area is unoccupied. Reconnect the terminal leads and disconnect the vacuum pump. Install refrigerant back into the system, then power the system on to allow the refrigerant to run through it.