10

I'am facing following issue while installing pod.

[!] Error installing Mapbox-iOS-SDK [!] /usr/bin/curl -f -L -o /var/folders/qn/l5lqh07s5sscfzbm1tklmzgr0000gn/T/d20200915-46243-1aqah9u/file.zip https://api.mapbox.com/downloads/v2/mobile-maps/releases/ios/packages/6.1.0/mapbox-ios-sdk-dynamic.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.9.3 cocoapods-downloader/1.4.0'

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (22) The requested URL returned error: 401 Unauthorized

I have added .netrc file in in home directory still facing issue.

Pod Error 1

roger10
  • 101
  • 1
  • 5
  • After adding .netrc file content it give me ```curl: (22) The requested URL returned error: 403 Forbidden``` error. Any idea? – Dhaval Kansara Feb 05 '21 at 07:24

3 Answers3

13

Since Mapbox 6.x you have to indicate credential to retrieve latest available pod version: https://docs.mapbox.com/ios/maps/overview/#configure-credentials

You can add credential before pod install / pod update process and remove it after with this macos script for example:

echo "Generate credential for mapbox"
echo "machine api.mapbox.com" > ~/.netrc
echo "login mapbox" >> ~/.netrc
echo "password <INSERT API TOKEN>" >> ~/.netrc

To delete this entry later :

sed -i '' -e '/^machine api.mapbox.com$/{N;N;d;}' ~/.netrc
Rudy
  • 131
  • 2
9

Looks like there is some issue in creating .netrc file. You can use next tips to create a .netrc file before Mapbox installation:

To create .netrc file do next

Fire up Terminal

cd ~ (go to the home directory)

touch .netrc (create file)

open .netrc (open .netrc)

Set required data.

Save

.netrc file should be like this

machine api.mapbox.com login mapbox password <secret_key_created_from_your_mapbox_account>

If you created .netrc file regarding this instruction, mapbox cocoapods should install.

VIVEK
  • 111
  • 2
  • 6
3

https://docs.mapbox.com/ios/navigation/guides/install/

A secret access token with the Downloads:Read scope. From your account's tokens page, click the Create a token button. From the token creation page, give your token a name and make sure the box next to the Downloads:Read scope is checked. Click the Create token button at the bottom of the page to create your token. The token you've created is a secret token, which means you will only have one opportunity to copy it somewhere secure.