There are two ways to obtain this number, one is done by snail mail and is a mess. You can find the procedure here : https://www.welcometofrance.com/en/fiche/registering-for-social-security
And one can actually be done online, if you have the special Passport Talent, it is much faster and convenient (perhaps it's possible for other visas, but I'm not sure)
To do so, your employer (e.g. yourself if you are a startup founder) should register on this website : https://immatriculation-travailleurs-etrangers.ameli.fr/en/login
This website is available in English.
Your employer need nothing more than an email to register.
Once it's done, he should login then click on "New File"
Fill in the Employee details, the form has a field for "Social Security Number" but very fortunately, you do not have to fill it. Duh.
The address doesn't matter much, as they will NOT require a proof of address at this stage. Also, everything is done online, so they will NOT ship anything there. Only the emails are very important.
Then the employer need to fill the company details, company address, company name etc... so this procedure only works if you have a French company (even though the Passport Talent can also work if you don't have an actual French company)
The "SIRET" number is a French company registration number and you can find it online with many different websites.
on the next page, the following required documents are pretty light.
You need either the picture of your Titre de Sejour (the pink card) if you already have it, or the picture of the visa they gave you to enter France, I mean this visa :
This card but it should clearly say "Passeport Talent" on it:
The picture of your actual passport.
A birth certificate (english certified translation should be fine)
A copy of the contract you signed with the company.
And a RIB so that the social security knows where to send you the money.
In France, a "RIB" or "Relevé d'Identité Bancaire" is a document that show your bank account details.
If your bank is N26, this is the procedure to download it (website online, not in the app) : https://mag-fr.n26.com/comment-t%C3%A9l%C3%A9charger-votre-rib-n26-depuis-la-webapp-cdad41ebca54?gi=b2bcfb9c0597
To my knowledge, you need a bank account in the EU, doesn't matter if it's in France or not. So no need to bother doing all the heavy French bank paperwork, just use N26 or Revolt and or whatnot and you can do everything from home.
If any of the docs you provided is too big, you can reduce the size of a PDF here https://pdfcompressor.com/ (they limit all files to 2 MB, which is not enough)
Just click next and submit.
Now you can periodically reconnect to this website to see the progress of your application.
I just did it, so I don't know how long it takes. I'll keep you updated.