Nix run error: Problem with the SSL CA cert

I recently started trying nix.

I ran the following command

nix run nixpkgs#hello
error: unable to download 'https://cache.nixos.org/ndlhi6cziiqnps4a1cy61px0b4cgrlf4.narinfo': Problem with the SSL CA cert (path? access rights?) (77)

nix-info output

 nix-shell -p nix-info --run "nix-info -m"                                                                                                                                                                                                          
 - system: `"x86_64-darwin"`
 - host os: `Darwin 21.6.0, macOS 10.16`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.16.1`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

with --debug flag

nix run nixpkgs#hello  --debug                                                                                                                                                                                                                         !+[main]
performing daemon worker op: 11
acquiring write lock on '/nix/var/nix/temproots/1965'
performing daemon worker op: 1
using cache entry '{"name":"flake-registry.json","type":"file","url":"https://channels.nixos.org/flake-registry.json"}' -> '{"etag":"W/\"43db6804212d24502998f7b07a8419b0b036e79147c186c4fb6221a4f24886c9\"","url":"https://channels.nixos.org/flake-registry.json"}', '/nix/store/h10gk87i8p5j5ii0viz0ss67cx345bwx-flake-registry.json'
performing daemon worker op: 11
performing daemon worker op: 12
looked up 'flake:nixpkgs' -> 'github:NixOS/nixpkgs/nixpkgs-unstable'
performing daemon worker op: 11
performing daemon worker op: 1
using cache entry '{"name":"source","type":"file","url":"https://api.github.com/repos/NixOS/nixpkgs/commits/nixpkgs-unstable"}' -> '{"etag":"W/\"ca5a5f06773ba60b34f6461f4b4b0330f8fece9b0c35d51f6c351bfd3f96d181\"","url":"https://api.github.com/repos/NixOS/nixpkgs/commits/nixpkgs-unstable"}', '/nix/store/1bji7c480lggl9jli7pkilnpjrp70x7z-source'
HEAD revision for 'https://api.github.com/repos/NixOS/nixpkgs/commits/nixpkgs-unstable' is af21c31b2a1ec5d361ed8050edd0303c31306397
performing daemon worker op: 11
performing daemon worker op: 1
using cache entry '{"rev":"af21c31b2a1ec5d361ed8050edd0303c31306397","type":"git-tarball"}' -> '{"lastModified":1686089707,"rev":"af21c31b2a1ec5d361ed8050edd0303c31306397"}', '/nix/store/6h604y63cq466hzrc7824rns999ka9r0-source'
performing daemon worker op: 26
got tree '/nix/store/6h604y63cq466hzrc7824rns999ka9r0-source' from 'github:NixOS/nixpkgs/af21c31b2a1ec5d361ed8050edd0303c31306397'
checking access to '/nix/store/6h604y63cq466hzrc7824rns999ka9r0-source/flake.nix'
evaluating file '/nix/store/6h604y63cq466hzrc7824rns999ka9r0-source/flake.nix'
performing daemon worker op: 19
old lock file: {
  "nodes": {
    "root": {}
  },
  "root": "root",
  "version": 7
}
computing lock file node ''
new lock file: {
  "nodes": {
    "root": {}
  },
  "root": "root",
  "version": 7
}
trying flake output attribute 'apps.x86_64-darwin.hello'
using cached attrset attribute ''
trying flake output attribute 'packages.x86_64-darwin.hello'
using cached attrset attribute ''
trying flake output attribute 'legacyPackages.x86_64-darwin.hello'
trying flake output attribute 'hello'
using cached attrset attribute ''
using cached string attribute 'legacyPackages.x86_64-darwin.hello.type'
using cached string attribute 'legacyPackages.x86_64-darwin.hello.drvPath'
performing daemon worker op: 1
using cached string attribute 'legacyPackages.x86_64-darwin.hello.outPath'
using cached string attribute 'legacyPackages.x86_64-darwin.hello.outputName'
using cached string attribute 'legacyPackages.x86_64-darwin.hello.name'
using cached string attribute 'legacyPackages.x86_64-darwin.hello.pname'
performing daemon worker op: 40
querying info about missing paths...
starting pool of 24 threads
checking substituter 'https://cache.nixos.org' for path '/nix/store/ndlhi6cziiqnps4a1cy61px0b4cgrlf4-hello-2.12.1'
querying info about '/nix/store/ndlhi6cziiqnps4a1cy61px0b4cgrlf4-hello-2.12.1' on 'https://cache.nixos.org'...
downloading 'https://cache.nixos.org/ndlhi6cziiqnps4a1cy61px0b4cgrlf4.narinfo'...
starting download of https://cache.nixos.org/ndlhi6cziiqnps4a1cy61px0b4cgrlf4.narinfo
finished download of 'https://cache.nixos.org/ndlhi6cziiqnps4a1cy61px0b4cgrlf4.narinfo'; curl status = 77, HTTP status = 0, body = 0 bytes
error: unable to download 'https://cache.nixos.org/ndlhi6cziiqnps4a1cy61px0b4cgrlf4.narinfo': Problem with the SSL CA cert (path? access rights?) (77)

curl output

curl -i https://cache.nixos.org/ndlhi6cziiqnps4a1cy61px0b4cgrlf4.narinfo                                                                                                                                                                            !+[main]
HTTP/2 200
last-modified: Sat, 03 Jun 2023 07:01:11 GMT
etag: "1da85acb2f2f7f6fea32b27af2285b2c"
x-amz-server-side-encryption: AES256
content-type: text/x-nix-narinfo
server: AmazonS3
via: 1.1 varnish, 1.1 varnish
accept-ranges: bytes
date: Wed, 07 Jun 2023 17:21:12 GMT
age: 54552
x-served-by: cache-iad-kjyo7100142-IAD, cache-tyo11944-TYO
x-cache: HIT, HIT
x-cache-hits: 2, 1
x-timer: S1686158473.536580,VS0,VE1
access-control-allow-origin: *
content-length: 580

StorePath: /nix/store/ndlhi6cziiqnps4a1cy61px0b4cgrlf4-hello-2.12.1
URL: nar/0rkqm5i7f9hq7aia9k8j6iyl33pjpxanc0mnp5rh0w7k6w65dd4d.nar.xz
Compression: xz
FileHash: sha256:0rkqm5i7f9hq7aia9k8j6iyl33pjpxanc0mnp5rh0w7k6w65dd4d
FileSize: 25368
NarHash: sha256:0r780x8d3kwhmy4m8xh40d96ld04jrv6hc1r0sz1fjddlgin3vv8
NarSize: 74704
References: vm7hmrl5s80yj6b97mqynxhdnx5jk7hi-swift-corefoundation-unstable-2018-09-14
Deriver: s9hpclcaw63w3rksla6rfjcpc00x1my3-hello-2.12.1.drv
Sig: cache.nixos.org-1:vVOD5/eknF7IcK3JtjXHECgD1ABOZpxrweCPXxJUoSfSW8uifaXaMryXy5nCDO9Oryhs7wUxPrmTuUfE8bM4Bw==

It would help if you could tell me what areas I should look into next.

Self resolved.
I uninstalled according to doc and then reinstalled.