Homebrew install specific version of formula?

后端 未结 27 2492
渐次进展
渐次进展 2020-11-21 11:21

How do I install a specific version of a formula in homebrew? For example, postgresql-8.4.4 instead of the latest 9.0.

27条回答
  •  萌比男神i
    2020-11-21 12:20

    Upgraded Postgres by accident?

    My case:

    • postgresql was upgraded from 11 to 12 accidentally (after running brew upgrade without arguments)
    • I want to keep Postgres 11.

    Solution:

    1. Stop the DB:
    brew services stop postgresql
    
    1. Install Postgres 11:
    brew install postgresql@11
    
    1. Enable it:
    brew link postgresql@11 --force
    
    1. (Optional) Rename DB data directory from postgres to postgres@11:
    cd /usr/local/var
    ls -lh
    mv postgresql@11 postgresql@11-fresh-backup
    mv postgres postgresql@11
    
    1. Start the DB:
    brew services start postgresql@11
    

    If you have any errors, check /usr/local/var/log/postgresql@11.log (notice the @11).

提交回复
热议问题