Revision 13797
Added by Aaron Marcuse-Kubitza over 10 years ago
Makefile | ||
---|---|---|
141 | 141 |
$(asAdmin) /etc/init.d/postgresql $(1) |
142 | 142 |
endef |
143 | 143 |
|
144 |
macPostgresDir := /Library/PostgreSQL/9.3 |
|
145 |
define macUsePostgresLib |
|
146 |
sudo mv $(libDest) $(libDest).old||sudo rm -f $(libDest) |
|
147 |
sudo ln -s $(macPostgresDir)/lib/$(1) $(libDest) |
|
148 |
|
|
149 |
endef |
|
150 |
libDest = /usr/lib/$(1) |
|
151 |
|
|
152 |
macPostgresLibs := libcrypto libcrypto.1.0.0 libssl libssl.1.0.0 libpq.5 |
|
153 |
macPostgresLibs := $(macPostgresLibs:%=%.dylib) |
|
154 |
|
|
144 |
macPostgresDir := /usr/local/var/postgres |
|
155 | 145 |
define pg_ctl-Darwin |
156 |
(cd /; $(asAdmin) pg_ctl -D $(macPostgresDir)/data -l $(macPostgresDir)/data/postgres.log $(1)) |
|
157 |
# cd: due to pg_ctl bug, current directory must be accessible by it |
|
158 |
sleep 2 |
|
146 |
launchctl $(1) ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist |
|
159 | 147 |
endef |
160 | 148 |
|
161 | 149 |
postgres_restart: postgres_restart-$(os) _always ; |
... | ... | |
165 | 153 |
@echo $(call pg_ctl-$(os),restart) |
166 | 154 |
@$(wait) |
167 | 155 |
postgres_restart-Darwin: _always |
168 |
$(call pg_ctl-$(os),restart) |
|
156 |
@echo $(call pg_ctl-$(os),unload) |
|
157 |
@echo $(call pg_ctl-$(os),load) |
|
169 | 158 |
|
170 | 159 |
confirmPostgresReload = $(call confirm,Modifying postgresql.conf and pg_hba.conf) |
171 | 160 |
|
... | ... | |
187 | 176 |
define postgresReload-Darwin |
188 | 177 |
@$(confirmPostgresReload) |
189 | 178 |
chmod a+r schemas/*.conf |
190 |
-$(asAdmin) mv -n $(macPostgresDir)/data/postgresql.conf $(macPostgresDir)/data/postgresql.conf.old
|
|
191 |
$(asAdmin) cp schemas/postgresql.Mac.conf $(macPostgresDir)/data/postgresql.conf
|
|
192 |
-$(asAdmin) mv -n $(macPostgresDir)/data/pg_hba.conf $(macPostgresDir)/data/pg_hba.conf.old
|
|
193 |
$(asAdmin) cp schemas/pg_hba.Mac.conf $(macPostgresDir)/data/pg_hba.conf
|
|
194 |
-$(asAdmin) mv -n $(macPostgresDir)/data/pg_ident.conf $(macPostgresDir)/data/pg_ident.conf.old
|
|
195 |
$(asAdmin) cp schemas/pg_ident.Mac.conf $(macPostgresDir)/data/pg_ident.conf
|
|
179 |
-$(asAdmin) mv -n $(macPostgresDir)/postgresql.conf $(macPostgresDir)/postgresql.conf.old
|
|
180 |
$(asAdmin) cp schemas/postgresql.Mac.conf $(macPostgresDir)/postgresql.conf |
|
181 |
-$(asAdmin) mv -n $(macPostgresDir)/pg_hba.conf $(macPostgresDir)/pg_hba.conf.old
|
|
182 |
$(asAdmin) cp schemas/pg_hba.Mac.conf $(macPostgresDir)/pg_hba.conf |
|
183 |
-$(asAdmin) mv -n $(macPostgresDir)/pg_ident.conf $(macPostgresDir)/pg_ident.conf.old
|
|
184 |
$(asAdmin) cp schemas/pg_ident.Mac.conf $(macPostgresDir)/pg_ident.conf |
|
196 | 185 |
$(MAKE) postgres_restart-$(os) |
197 | 186 |
|
198 | 187 |
endef |
... | ... | |
223 | 212 |
# ignore errors if conf files already edited |
224 | 213 |
|
225 | 214 |
postgres-Darwin: _always |
226 |
@echo $(emph)'Installing PostgreSQL on Mac OS X:'$(endEmph) |
|
227 |
@echo 'Download it using the topmost "Mac OS X" link at http://http://www.enterprisedb.com/products-services-training/pgdownload' |
|
228 |
@echo 'Open the disk image' |
|
229 |
@echo 'Run the installer in it' |
|
230 |
@$(wait) |
|
231 |
$(foreach lib,$(macPostgresLibs),$(call macUsePostgresLib,$(lib))) |
|
215 |
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" |
|
216 |
brew doctor |
|
217 |
brew install postgis # also installs PostgreSQL |
|
218 |
-$(postgresReload-Darwin) |
|
232 | 219 |
-sudo easy_install psycopg2 |
233 | 220 |
-$(postgresReload-Darwin) |
234 | 221 |
|
Also available in: Unified diff
/Makefile, /README.TXT: PostgreSQL: Mac OS X: switched to using homebrew, which supports PostGIS