{"id":8125,"date":"2020-11-23T12:48:22","date_gmt":"2020-11-23T18:48:22","guid":{"rendered":"https:\/\/bobbeaty.com\/wp\/?p=8125"},"modified":"2020-11-23T13:19:28","modified_gmt":"2020-11-23T19:19:28","slug":"updating-postgres-to-13-1-with-homebrew","status":"publish","type":"post","link":"https:\/\/bobbeaty.com\/wp\/archives\/8125","title":{"rendered":"Updating Postgres to 13.1 with Homebrew"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/bobbeaty.com\/wp\/wp-content\/uploads\/2008\/05\/postgresql.jpg\" alt=\"PostgreSQL.jpg\" title=\"PostgreSQL.jpg\" border=\"0\" width=\"128\" height=\"128\" style=\"float:right; margin-left: 10px;\" \/><\/p>\n<p>With the update to macOS 11 Big Sur, and the updates I keep doing to my linode box, I thought it would be a nice time to update Postgres to the latest that Homebrew had - I was expecting 12.5, as that's what's latest for Ubuntu 20.04LTS at linode, and it was surprisingly easy - even with the major version update.<\/p>\n<p>The standard upgrade for anything in Homebrew is:<\/p>\n<pre class=\"bash\" style=\"font-family:monospace;\">  $ brew upgrade postgres<\/pre>\n<p>and it will upgrade the binaries as well as upgrade the database files - if it's a minor release change. But if it's a major release change - like it was for me from 12.x to 13.x, then you also have to run:<\/p>\n<pre class=\"bash\" style=\"font-family:monospace;\">  $ brew postgresql-upgrade-database<\/pre>\n<p>and that will update the database files and place the old database files in <tt>\/usr\/local\/var\/postgres.old<\/tt> so after you're sure everything is running OK, you just need to:<\/p>\n<pre class=\"bash\" style=\"font-family:monospace;\">  $ <span style=\"color: #c20cb9; font-weight: bold;\">rm<\/span> <span style=\"color: #660033;\">-rf<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>usr<span style=\"color: #000000; font-weight: bold;\">\/<\/span>local<span style=\"color: #000000; font-weight: bold;\">\/<\/span>var<span style=\"color: #000000; font-weight: bold;\">\/<\/span>postgres.old<\/pre>\n<p>and it's all cleaned up.<\/p>\n<p>The one wrinkle is that I have set up the environment variable not to do automatic cleanups of the old versions of packages - because I wanted to have multiple versions of Leiningen hanging around, so I needed to clean up the old versions of postgres with:<\/p>\n<pre class=\"bash\" style=\"font-family:monospace;\">  $ brew cleanup postgres\n  Removing: <span style=\"color: #000000; font-weight: bold;\">\/<\/span>usr<span style=\"color: #000000; font-weight: bold;\">\/<\/span>local<span style=\"color: #000000; font-weight: bold;\">\/<\/span>Cellar<span style=\"color: #000000; font-weight: bold;\">\/<\/span>postgresql<span style=\"color: #000000; font-weight: bold;\">\/<\/span><span style=\"color: #000000;\">11.1<\/span>_1... <span style=\"color: #7a0874; font-weight: bold;\">&#40;<\/span><span style=\"color: #000000;\">3<\/span>,<span style=\"color: #000000;\">548<\/span> files, 40.3MB<span style=\"color: #7a0874; font-weight: bold;\">&#41;<\/span>\n  Removing: <span style=\"color: #000000; font-weight: bold;\">\/<\/span>usr<span style=\"color: #000000; font-weight: bold;\">\/<\/span>local<span style=\"color: #000000; font-weight: bold;\">\/<\/span>Cellar<span style=\"color: #000000; font-weight: bold;\">\/<\/span>postgresql<span style=\"color: #000000; font-weight: bold;\">\/<\/span><span style=\"color: #000000;\">12.1<\/span>... <span style=\"color: #7a0874; font-weight: bold;\">&#40;<\/span><span style=\"color: #000000;\">3<\/span>,<span style=\"color: #000000;\">217<\/span> files, 37.7MB<span style=\"color: #7a0874; font-weight: bold;\">&#41;<\/span>  <\/pre>\n<p>and then the old versions are cleaned up as well.<\/p>\n<p>I was expecting 12.5... but got all the way to 13.1 - nice. \ud83d\ude42 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the update to macOS 11 Big Sur, and the updates I keep doing to my linode box, I thought it would be a nice time to update Postgres to the latest that Homebrew had &#8211; I was expecting 12.5, as that&#8217;s what&#8217;s latest for Ubuntu 20.04LTS at linode, and it was surprisingly easy &#8211; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,3,4],"tags":[],"class_list":["post-8125","post","type-post","status-publish","format-standard","hentry","category-clojure-coding","category-coding","category-open-source-software"],"_links":{"self":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/posts\/8125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/comments?post=8125"}],"version-history":[{"count":1,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/posts\/8125\/revisions"}],"predecessor-version":[{"id":8126,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/posts\/8125\/revisions\/8126"}],"wp:attachment":[{"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/media?parent=8125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/categories?post=8125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bobbeaty.com\/wp\/wp-json\/wp\/v2\/tags?post=8125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}