Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI command pmtiles version blank when installed using homebrew #203

Open
mizmay opened this issue Jan 10, 2025 · 3 comments
Open

CLI command pmtiles version blank when installed using homebrew #203

mizmay opened this issue Jan 10, 2025 · 3 comments

Comments

@mizmay
Copy link

mizmay commented Jan 10, 2025

When I run pmtiles version to see what build of the CLI I am running I always get pmtiles dev, commit none, built at unknown.

It's an issue only because I'm using the CLI infrequently so am always inclined to check whether I have a recent enough version when I go to try something.

Steps to reproduce:

  1. Download current / latest release for my m1 2020 Macbook Air go-pmtiles-1.23.1_Darwin_arm64.zip

  2. Open to install

Last login: Fri Jan 10 12:25:24 on ttys009
/Users/mizmay/Downloads/pmtiles ; exit;
mizmay@Stephanies-Personal ~ % /Users/mizmay/Downloads/pmtiles ; exit;
Usage: pmtiles <command>

Flags:
  -h, --help    Show context-sensitive help.

Commands:
  convert <input> <output>
    Convert an MBTiles or older spec version to PMTiles.

  show <path>
    Inspect a local or remote archive.

  tile <path> <z> <x> <y>
    Fetch one tile from a local or remote archive and output on stdout.

  extract <input> <output>
    Create an archive from a larger archive for a subset of zoom levels or
    geographic region.

  verify <input>
    Verify the correctness of an archive structure, without verifying individual
    tile contents.

  serve <path>
    Run an HTTP proxy server for Z/X/Y tiles.

  upload --bucket=STRING <input-pmtiles> <remote-pmtiles>
    Upload a local archive to remote storage.

  version
    Show the program version.

Run "pmtiles <command> --help" for more information on a command.

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]
  1. Check version
mizmay@Stephanies-Personal ~ % pmtiles version --help
Usage: pmtiles version

Show the program version.

Flags:
  -h, --help    Show context-sensitive help.
mizmay@Stephanies-Personal ~ % pmtiles version       
pmtiles dev, commit none, built at unknown

Other things I tried

I tried brew install pmtiles and got the same result.

@mizmay mizmay changed the title pmtiles version doesn't work CLI command pmtiles version doesn't work Jan 10, 2025
@bdon
Copy link
Member

bdon commented Jan 11, 2025

This is what the output of pmtiles 1.23.1 looks like for me:

pmtiles version
pmtiles 1.23.1, commit cb7d438ef3ce0c58066286727c5e8844f46628dc, built at 2025-01-06T06:31:36Z

Can you type which pmtiles? Is it pointing to an executable in your Homebrew directory? You should either remove the Homebrew one if you're going to use the binary from https://github.com/protomaps/go-pmtiles/releases/tag/v1.23.1 or put the binary earlier on your path.

The Homebrew install is probably building the project from source (I don't maintain it) and does not include the release information. The releases for Mac are signed with my paid developer key so it doesn't require bypassing the security warning on MacOS.

@mizmay
Copy link
Author

mizmay commented Jan 12, 2025

You are right it was the Homebrew version plus some weirdness with the path. When I uninstalled that plus moved the executable from /usr/local/bin to /opt/local/bin, pmtiles version works.

mizmay@Stephanies-Personal bin % pmtiles version
pmtiles 1.23.1, commit cb7d438ef3ce0c58066286727c5e8844f46628dc, built at 2025-01-06T06:31:36Z

Feel free to close (or leave open). Thanks!

@bdon
Copy link
Member

bdon commented Jan 12, 2025

This line in the Homebrew formula: https://github.com/Homebrew/homebrew-core/blob/be72125f81db1b4daab71bb824ddf28c8c91811c/Formula/p/pmtiles.rb#L25

needs to pass this additional ldflag to populate the version information:

go build -ldflags="-X 'main.version=1.23.1'" main.go

@bdon bdon changed the title CLI command pmtiles version doesn't work CLI command pmtiles version doesn't work when installed using home-brew Jan 12, 2025
@bdon bdon changed the title CLI command pmtiles version doesn't work when installed using home-brew CLI command pmtiles version blank when installed using homebrew Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants