Hi,
You will need to go to an immigration office and obtain the correct forms, You will need a current passport with up to 6 months remaining, and many photo copies. You will also need 10 passport size photos and a 60Dh stamp ! That's the easy bit.
You will also need a convertible bank account with a few thousand pounds in the account and a letter from the bank. You may also need to own a property or have a long term rental agreement.
Once all the documentation is accepted you will be given a piece of paper which certifies your intention to become a resident. After about a month your card will be issued. Normally a first application is valid for one year.
Hope this helps