For some unknown reason, when searches are performed for BMW Cam Sensors, this particular page is called up more than my other one.
You can find my M52 97 2.8l Camshaft page here:
M52 Cam Sensor
This is a reformat and save of a page in Roadfly's Achives.
I saved it so the data wouldn't be lost.
I didn't write it, and I haven't verified it, so I take no responsibility
for it's accuracy.
---Giznaz
DIY: Replacing 1.9's Camshaft Sensor.
Text by bmv. Photos by Z3 Big Daddy. [Direct flames accordingly.]

(Located on front of Timing Cover, off Intake Cam)
General Outline
Much easier to do than explain. Basically, after verifying that you do indeed
need to replace it, you'll have to dismantle, but not totally remove, the upper
section of the intake housing, along with some of the hoses & connections attached
to the housing, in order to get at the receptacle that the Cam Sensor's 'plug' end plugs
into the ECU (Note 1). Replacing the 'sensor' end of the Cam Sensor end is simple.

(Note 2)
Two concerns: First, snaking the plug end of the wire into the computer's
receptacle is like pushing a rope in mid air;
and, second, the cheapo plastic race/bracket, aka Cable Guide, that holds the wire around
the timing cover's corner is not affix by a screw or bolt; and, can be easily broken,
due to it becoming brittle over time & use.
Fortunately, it's a relatively easy DIY, requiring no more than a few simple tools and
less than one hour to complete. As for motivation, dealers may charge as much as
three times as much as DIY- Presumably, primarily due to some of the time-consuming
'Mickey Mouse' aspects of it.
Diagnosing/Verifying the problem
First, is your current Camshaft Sensor defective? Since a Cam Sensor gone 'bad' will
send inaccurate timing input to the ECU, the symptoms will relate to the engine's timing,
naturally. Temporary fuel cutouts and/or different idling characteristics may be observed.
Backfire(s)too, tho, in seemingly rare situations.
Check Engine Light.
Since timing affects emissions, of course, you should get a CEL.
And here's where it gets bemusing for the DIYer. The
PeakeResearch R5/fcx reset tool will
display-
--THE WRONG CODE!!!
Actually, it'll falsely display "94" (Indicating, "EMS Input", BTW.), instead of the
correct, "74", that their manual lists for the Cam Sensor.
Okay, then, if you're experiencing the common problems; have gotten the CEL; and, have
confirmed the proper (And, again, WRONG!) fault code from a R5/fcx-Replace the Cam Sensor.
Depending upon the severity of the symptoms, it's unlikely to be an urgent situation,
i.e., an immediate tow-it-to-a-dealer-now type- Nonetheless, it probably should be
attended to promptly, by proceeding as follows:
P/Ns
12-14-1-743-072 ---- Camshaft Position Sensor
12-14-1-748-398 ---- O-Ring
12-14-1-743-197 ---- Cable Guide
(Not absolutely essential, but the original
will break very easily!
Be sure to save the old one! Even while broken, you'll
still need to scavenge
bits of it for the new one. Further, if/when you do break
the old one,
and the new one is still on back-order,
it won't prevent you from
replacing the Cam Sensor.)
12-14-1-743-198 ---- Bracket
(Not really needed, as the old one should be
reused.)
Total Cost = approximately $100-$125. [Don't forget to use your BMW CCA discount!]
Tools
flat screwdriver
5mm hex key
10mm socket
11mm socket
ratchet
11mm open/box wrench
something to prop with. Chock of wood/bungee cord/whatever.
snaking device or some sort, such as string
Additional Reference - See
Bentley's
[Weak!] Section: "Camshaft position sensor, replacing", found on p 120-5, & (Notes).

Steps
Removal
1. Disconnect the large hose clamp, engine side of the AFM. (Notes 2 & 3)
2. Remove the small hose (vacuum?) just above the oil filter cap; no tools required.
(Note 4)
3. There are five bolts/nuts to the upper intake housing; and, all are 11mm.
One bolt is right on top (Note 5); two nuts are near the oil dipstick (In contrast
to the pic, neither the dipstick nor the its bracket need to be removed.) (Note 6):

Z3BD is removing one
Of two inlet nuts.
In upper left of pic,
The top bolt can be
Seen, prior to removal.

In the upper half of
this pic, around the two
inlets, the two studs &
the thread where the
top bolt screws into
are visible.
Another in front that attaches, via a bracket, to the head. (Note 7); also 11mm.

See black "U"-shaped
bracket, with hole in it,
connecting the head
to
upper intake housing.
Remove bolt that secures
Bracket to the upper
Intake housing.

The fifth one, also 11mm, is in back, securing it to the cowl/bulkhead area.
Use an 11mm box wrench backwards, to Loosen Only - Do Not Remove!
It's kinda tight back there, but nothing else needs to be touched.

BTW, neither the fuel injector cables nor their cover plate on top of the intake
housing should need to be removed.
4. Okay, you should now be able to lift up the upper intake housing from the lower &
rest of engine. However, is there sufficient room for you to work?
A) bmv used a small chock of 2"x4" to prop up the upper intake housing [Skip to #5].
B) If that doesn't provide enough space, as it didn't for Z3BD, you'll need to remove
additional stuff attached to the upper intake housing, e.g., Idle Speed Valve,
Throttle Position Sensor, Hose(s), etc. until adequate space is provided. (Note 8)

*The lower half of the
bottom pic highlights what
needed to be disconnected.

*Bottom of pic shows
after disconnection
of hose & connectors.
At this point, it might be wise to cover the (now open) inlets of the lower
intake housing, to prevent any stuff, e.g., small C-clips, from getting into the
engine.
5. Remove old Cam Sensor, from the sensor end, on the front of the head, with a
5mm hex key. (Note 9)

6. Follow the wire, as it goes from the timing cover to the engine.
7. Next, near the Sensor is the bracket, with a 10mm bolt, to be removed. (Note 10)
*Save the bracket that it secures!
8. Next is one of the tricky aspects. Around the corner of the head is the
aforementioned cheapo plastic race (cable guide). It's secured by plug into a
boss. i.e., no bolt, nut, or screw. While you can, effectively, guarantee on
breaking it, it might be conceivable to gently tap it out, from the bulkhead side,
without breaking it. - Given how it goes back in (See step 13 below).
Dunno, bmv got impatient and deliberately broke his...Z3BD's broke as well:

*Whether broken or not, save it! You'll need at least part of it for installation.
To reiterate from above, if/when you break the old cable guide, and the new
one is still on back-order, you can still proceed. You'll just have to secure
the wire some other way.
9. Cam Sensor' plug removal.

Here is the Cam Sensor's plug.
Seen just above the shadow.
BTW, next to it is the
Crankshaft Sensor.
WARNING!!! EXTREME CAUTION REQUIRED HERE:

Here, Z3BD is removing
the small wire C-clip
that secures the sensor's
plug end.
Down by the ECU, it would be very nice if you're able to disconnect the plug end, by gently pinching the thin wire "C" clip enough until you can remove the plug. HOWEVER, since there's precious little space to work with, and, IIRC, the replacement sensors don't come with one, you might have to remove the clip itself to be able to unplug the sensor. Extreme care must be taken here, obviously, so as the clip doesn't go 'boing' and end up where it shouldn't. :-O [Did you remember to cover the inlet runners of the lower intake housing?!] Do whatever it takes- Use a length of thread to tether the clip, or needlenose pliers, or something.
DO NOT LOSE/DROP IT!
Oh, yeah, and if you do, you'll find out that BMW doesn't sell those separately
either.
Consequently, you may find yourself in this unenviable position, as Z3BD
hypothetically demonstrates =8^):

10. In order to snake the new Cam Sensor in, one suggestion would be to use a
string to connect the 'plug' end of the old sensor to the 'sensor' end of the new
sensor; and, pull thru.

Installation
11. Install the new sensor's plug into the ECU port. Secure with C-clip.
CAREFULLY!!!
12. Put the wire of the new sensor in the old cable guide, if the old one wasn't
broken. This will require, perhaps, a wire cutter or some sort of small shears
to extricate the old sensor's wire out of the cable guide.
Or, put new sensor's wire in new cable guide, if the old cable guide was broken.
Be sure to scavenge any bits from the old one that the new one doesn't have.
*If the old cable guide was broken AND the new one is still back-ordered, again,
you can still do the job- Just use something else to tie the wire down (ziptie?).
13. Install cable guide, with sensor's wire secured inside, into head.

14. Put 10mm bolt that holds bracket near the Sensor back into timing cover.
Torque spec. unknown.
15. Install new Cam Sensor, with new o-ring. Torque spec. unknown.

16. Reattach upper intake housing, and all other parts that were previously
dismantled, including hose/hose clamps, connections, etc.
Followup
17. Start car; check for leak around Sensor.
18. Enjoy the ~$200+ in savings vs. dealer, by DIY!
Notes

1. See "B" in Fig. 3, from Bentley's, p 113-3
2. See Fig. 4, from Bentley's, p 100-3
3. See Fig. 3, from Bentley's, p 110-2 / Fig. 2, p 113-2
4. See Fig. 2, from Bentley's, p 170-3
5. See Fig. 3, from Bentley's, p 020-9
6. See Fig. 6, from Bentley's, p 110-3
7. See Fig. 17, from Bentley's, p 130-11
8. See Fig. 3, from Bentley's, p 130-3
9. See Fig. 8, from Bentley's, p 120-5
10. See Fig. 3, from Bentley's, p 113-2
Disclaimer
While the task is much, much easier to actually do than having to explain it,
should you feel uncomfortable in
attempting to DIY, then, by all means, pay someone else to do it.
The above is intended solely for information purposes. We assume no
responsibility for what may or may not happen to your car.